html, body { margin: 0; height: 100%; background: #f8fafc; color: #15181d; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow: hidden; }
button { font: inherit; }
.muted { color: #667085 !important; }

.shell { display: grid; grid-template-columns: 206px 1fr; height: 100vh; background: #f8fafc; }
.app-rail { position: relative; display: flex; flex-direction: column; background: #f4f5f7; border-right: 1px solid #e4e7ec; padding: 18px 12px 14px; overflow: hidden; }
.brand-mark { width: 34px; height: 34px; border: 1px solid #d0d5dd; border-radius: 9px; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:12px; background:white; margin-bottom: 28px; }
.rail-company { display:flex; align-items:center; gap:9px; padding: 4px 4px 22px; }
.company-badge { width:27px; height:27px; display:flex; align-items:center; justify-content:center; border-radius:4px; background:#e8f3e9; color:#32734a; font-size:21px; font-weight:800; font-style:italic; }
.rail-nav .mud-nav-link { border-radius: 7px; margin-bottom: 4px; font-size: 13px; }
.rail-nav .mud-nav-link.active { background:#e5e7eb; color:#111827; }
.rail-footer { margin-top:auto; border-top:1px solid #e4e7ec; padding-top:12px; }
.user-row { display:flex; gap:9px; align-items:center; margin-top:10px; }
.shell-main { min-width:0; min-height:0; }

.chat-page { height:100vh; display:grid; grid-template-columns: 292px 1fr; background:white; }
.session-pane { border-right:1px solid #e4e7ec; background:#fff; padding: 14px 10px; overflow:hidden; display:flex; flex-direction:column; }
.session-pane-header { display:flex; justify-content:space-between; align-items:flex-start; padding:4px 5px 10px; }
.new-session-button { background:#4b5563 !important; color:white !important; text-transform:none !important; font-weight:600 !important; }
.session-list { margin-top:10px; overflow-y:auto; }
.session-row { width:100%; display:grid; grid-template-columns:minmax(0,1fr) 30px; align-items:center; border-radius:7px; }
.session-row:hover, .session-row.selected { background:#f2f4f7; }
.session-item { width:100%; min-width:0; border:0; background:transparent; display:grid; grid-template-columns:20px minmax(0,1fr); align-items:flex-start; gap:8px; padding:10px 4px 10px 8px; border-radius:7px; text-align:left; cursor:pointer; color:#20242b; }
.session-leading-icon { width:20px; display:flex; justify-content:center; align-items:flex-start; padding-top:1px; }
.session-copy { min-width:0; display:flex; flex-direction:column; gap:2px; }
.session-title { font-size:12.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
.session-age { color:#667085; font-size:11px; }
.session-delete { opacity:.42; justify-self:center; }
.session-row:hover .session-delete, .session-row.selected .session-delete { opacity:.9; }

.conversation-pane { position:relative; min-width:0; min-height:0; display:flex; flex-direction:column; background:#fbfcfd; }
.conversation-topbar { height:44px; border-bottom:1px solid #e4e7ec; display:flex; align-items:center; justify-content:space-between; padding:0 18px; background:white; }
.empty-chat { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:30px; transform: translateY(-3vh); }
.empty-greeting { font-weight:700 !important; margin-bottom:8px !important; }
.empty-composer-wrap, .suggestions { width:min(700px, 80vw); }
.suggestions { margin-top:30px; background:white; }
.suggestion { width:100%; display:flex; align-items:center; gap:10px; border:0; background:transparent; padding:10px 8px; text-align:left; border-radius:7px; cursor:pointer; color:#20242b; font-size:13px; }
.suggestion:hover { background:#f8fafc; }

.conversation-scroll { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:26px 24px 160px; }
.conversation-width { width:min(880px, calc(100vw - 570px)); min-width:460px; margin:0 auto; }
.composer-dock { position:absolute; left:0; right:0; bottom:0; padding:20px 24px 28px; background:linear-gradient(to bottom, rgba(251,252,253,0), #fbfcfd 30%); pointer-events:none; }
.composer-dock .conversation-width { pointer-events:auto; }
.chat-composer { background:white; border-color:#d8dde5 !important; box-shadow:0 5px 18px rgba(16,24,40,.05); }
.composer-text .mud-input-root { font-size:13px; }
.composer-toolbar { display:flex; align-items:center; justify-content:space-between; border-top:1px solid #f0f2f5; padding-top:5px; }
.provider-controls { display:flex; align-items:center; gap:8px; }
.provider-select { width:105px; }
.model-input { width:180px; }

.message-block { margin: 0 0 26px; }
.message-block.user { display:flex; justify-content:flex-end; }
.user-bubble { max-width:80%; background:#f1f2f4; padding:10px 13px; border-radius:11px; font-size:14px; line-height:1.45; }
.message-block.assistant { color:#1f2937; }
.trace-summary { color:#667085; font-size:11px; margin-bottom:6px; }
.trace-panels { margin-bottom:12px; }
.trace-panels .mud-expand-panel { box-shadow:none !important; border-bottom:1px solid #eef0f2; background:transparent; }
.trace-panels .mud-expand-panel-header { min-height:38px; padding:0 4px; }
.trace-title { display:flex; align-items:center; gap:8px; width:100%; font-size:11.5px; }
.trace-kind { font-weight:650; color:#111827; }
.trace-name { color:#344054; font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.trace-duration { margin-left:auto; color:#667085; font-size:11px; }
.json-label { display:block; color:#475467 !important; margin-bottom:4px !important; font-weight:700 !important; }
.json-box { background:#f8fafc; border:1px solid #eaecf0; border-radius:6px; padding:10px; overflow-x:auto; overflow-y:visible; max-height:none; font-size:11.5px; line-height:1.45; white-space:pre-wrap; word-break:break-word; }
.assistant-answer { white-space:pre-wrap; font-size:15px; line-height:1.62; padding-top:3px; }
.agent-working { display:flex; gap:10px; align-items:center; color:#667085; padding:10px 0 30px; }

.skills-page { height:100vh; overflow:auto; padding:26px 30px; background:#fbfcfd; }
.page-header { display:flex; align-items:flex-start; justify-content:space-between; max-width:1200px; margin:0 auto 22px; }
.skills-grid { display:grid; grid-template-columns: 360px minmax(0, 1fr); gap:18px; max-width:1200px; margin:0 auto; }
.skill-list-card, .skill-editor-card { background:white; }
.skill-list-item { width:100%; border:0; background:transparent; text-align:left; border-radius:8px; padding:11px; margin-bottom:3px; cursor:pointer; }
.skill-list-item:hover, .skill-list-item.selected { background:#f2f4f7; }
.skill-list-title-row { display:flex; align-items:center; gap:7px; }
.skill-name { font-weight:650; font-size:13px; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.skill-state { margin-left:auto; font-size:10px; padding:2px 6px; border-radius:10px; text-transform:uppercase; letter-spacing:.03em; }
.skill-state.active { background:#ecfdf3; color:#027a48; }
.skill-state.draft { background:#fff6ed; color:#b54708; }
.skill-description { display:block; color:#667085; font-size:11px; margin:5px 0 0 31px; line-height:1.4; }
.skill-editor-card { min-height:660px; }
.skill-empty { min-height:560px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; }
.skill-editor-top { display:grid; grid-template-columns:1fr 160px; gap:12px; }
.skill-body-editor textarea { font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; font-size:12px !important; line-height:1.5 !important; }
.editor-actions { display:flex; justify-content:space-between; align-items:center; margin-top:14px; gap:15px; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 72px 1fr; }
  .app-rail { padding:14px 8px; }
  .rail-company .mud-typography, .rail-nav .mud-nav-link-text, .rail-footer .mud-typography, .user-row > div { display:none; }
  .rail-company { justify-content:center; }
  .brand-mark { margin-left:auto; margin-right:auto; }
  .chat-page { grid-template-columns:240px 1fr; }
  .conversation-width { width:min(760px, calc(100vw - 350px)); min-width:320px; }
}

/* v0.4: session usage + rendered markdown */
.conversation-topbar-right { display:flex; align-items:center; gap:14px; }
.session-usage { display:flex; align-items:center; gap:12px; font-size:12px; color:#475467; white-space:nowrap; }
.session-token-count { font-variant-numeric: tabular-nums; }
.session-estimated-cost { color:#111827; font-weight:650; font-variant-numeric: tabular-nums; }

.assistant-answer { white-space:normal; }
.markdown-body { font-size:15px; line-height:1.62; }
.markdown-body > :first-child { margin-top:0; }
.markdown-body > :last-child { margin-bottom:0; }
.markdown-body p { margin:0 0 12px; }
.markdown-body strong { font-weight:700; color:#111827; }
.markdown-body em { font-style:italic; }
.markdown-body code { font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background:#f2f4f7; border:1px solid #eaecf0; border-radius:4px; padding:1px 4px; font-size:.92em; }
.markdown-body pre { background:#f8fafc; border:1px solid #eaecf0; border-radius:7px; padding:11px; overflow:auto; }
.markdown-body pre code { background:transparent; border:0; padding:0; }
.markdown-body ul, .markdown-body ol { margin:8px 0 14px 22px; padding:0; }
.markdown-body li { margin:3px 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { color:#111827; margin:18px 0 9px; line-height:1.3; }
.markdown-body h1 { font-size:22px; }
.markdown-body h2 { font-size:18px; }
.markdown-body h3 { font-size:15px; }
.markdown-body table { width:100%; border-collapse:separate; border-spacing:0; margin:12px 0 18px; border:1px solid #dfe3e8; border-radius:8px; overflow:hidden; background:#fff; }
.markdown-body th, .markdown-body td { padding:9px 12px; border-bottom:1px solid #e6e9ed; text-align:left; vertical-align:top; }
.markdown-body th { background:#f8fafc; color:#111827; font-weight:700; }
.markdown-body tr:last-child td { border-bottom:0; }
.markdown-body blockquote { margin:12px 0; padding:4px 0 4px 12px; border-left:3px solid #d0d5dd; color:#475467; }


/* v0.8: the conversation owns vertical scrolling.
   Expanded tool traces must never trap the mouse wheel/touchpad. */
.conversation-scroll {
  overflow-y:scroll;
  overflow-x:hidden;
  overscroll-behavior-y:auto;
  scrollbar-gutter:stable;
  touch-action:pan-y;
}
.trace-content {
  max-height:none;
  overflow:visible;
  overscroll-behavior:auto;
  touch-action:auto;
  padding:2px 8px 8px 0;
}
.trace-content .json-box {
  max-height:none;
  overflow-x:auto;
  overflow-y:visible;
  overscroll-behavior:auto;
}

/* v0.11 workspace attachments */
.composer-attachments { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 8px; }
.composer-actions { display:flex; align-items:center; gap:2px; }
.attachment-picker { width:38px; height:38px; display:inline-flex; align-items:center; justify-content:center; border-radius:50%; cursor:pointer; color:#596579; }
.attachment-picker:hover { background:#f2f4f7; }
.attachment-picker.disabled { opacity:.45; cursor:default; pointer-events:none; }
.attachment-picker input[type=file] { display:none; }
.user-attachments { display:flex; flex-wrap:wrap; gap:7px; margin-top:9px; padding-top:8px; border-top:1px solid rgba(0,0,0,.06); }
.user-attachment-link { display:inline-flex; align-items:center; gap:4px; text-decoration:none; color:#315b8a; font-size:12px; background:white; border:1px solid #d9dee6; border-radius:7px; padding:4px 7px; }
.user-attachment-link:hover { background:#f7f9fb; }

/* v0.12 helpdesk */
.helpdesk-page .session-pane { background:#fbfcfb; }
.helpdesk-page .new-session-button { background:#335f49 !important; }
.helpdesk-page .conversation-pane { background:#fcfdfc; }
.helpdesk-page .composer-dock { background:linear-gradient(to bottom, rgba(252,253,252,0), #fcfdfc 30%); }
.helpdesk-page .empty-greeting { font-size:28px !important; }
.helpdesk-page .suggestions { border-color:#dde6e0 !important; }
.helpdesk-composer-label { font-size:12px; color:#667085; padding-left:4px; }

.knowledge-page { height:100vh; overflow:auto; padding:28px 32px 48px; background:#fbfcfd; }
.knowledge-header { max-width:1180px; margin:0 auto 22px; display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.knowledge-page > .mud-alert { max-width:1180px; margin-left:auto; margin-right:auto; }
.knowledge-grid { max-width:1180px; margin:0 auto; display:grid; grid-template-columns:minmax(0, 1.3fr) minmax(320px, .7fr); gap:18px; align-items:start; }
.knowledge-card { background:white; min-height:320px; }
.knowledge-card-title { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; margin-bottom:16px; }
.knowledge-upload { display:inline-flex; align-items:center; gap:7px; border:1px solid #d0d5dd; border-radius:8px; padding:8px 11px; font-size:12px; font-weight:650; cursor:pointer; background:#fff; color:#344054; white-space:nowrap; }
.knowledge-upload:hover { background:#f8fafc; }
.knowledge-upload input[type=file] { display:none; }
.knowledge-working { display:flex; align-items:center; gap:8px; color:#667085; font-size:12px; margin:8px 0 12px; }
.knowledge-empty { min-height:205px; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:8px; color:#98a2b3; border:1px dashed #d8dde5; border-radius:9px; }
.knowledge-file-list { border-top:1px solid #eef0f2; }
.knowledge-file-row { display:flex; gap:10px; align-items:flex-start; padding:12px 2px; border-bottom:1px solid #eef0f2; }
.knowledge-file-copy { display:flex; flex-direction:column; min-width:0; gap:3px; }
.knowledge-file-name { font-size:13px; font-weight:650; color:#20242b; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.knowledge-file-meta { font-size:11px; color:#667085; }
.pipeline-list { display:flex; flex-direction:column; gap:13px; }
.pipeline-list > div { display:grid; grid-template-columns:14px 92px 1fr; align-items:center; column-gap:7px; font-size:12px; }
.pipeline-list strong { color:#344054; }
.pipeline-list span:last-child { color:#667085; }
.pipeline-dot { width:8px; height:8px; border-radius:50%; background:#d0d5dd; display:inline-block; }
.pipeline-dot.ready { background:#3b7a57; }

@media (max-width: 900px) {
  .knowledge-grid { grid-template-columns:1fr; }
  .knowledge-header { flex-direction:column; }
}

/* v0.17 Microsoft Entra authentication */
.public-shell { min-height:100vh; background:linear-gradient(135deg,#f7faf8 0%,#eef3f0 100%); overflow:auto; }
.landing-page { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:32px; box-sizing:border-box; }
.landing-card { width:min(620px,calc(100vw - 48px)); background:white; border:1px solid #dfe5e1; border-radius:16px; padding:52px 54px; box-shadow:0 18px 50px rgba(16,24,40,.08); text-align:left; }
.landing-mark { width:48px; height:48px; border:1px solid #cfd8d2; border-radius:12px; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:15px; margin-bottom:26px; background:#fff; }
.landing-kicker { color:#335f49 !important; font-weight:750 !important; letter-spacing:.08em !important; }
.landing-title { margin:4px 0 12px !important; font-weight:750 !important; letter-spacing:-.025em !important; }
.landing-copy { max-width:510px; color:#596579 !important; line-height:1.65 !important; margin-bottom:30px !important; }
.auth-message-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:30px; box-sizing:border-box; }
.auth-message-card { width:min(480px,calc(100vw - 48px)); background:#fff; }
.user-copy { min-width:0; }
.user-display-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.user-upn { display:block; max-width:145px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rail-signout { margin-top:9px; display:flex; align-items:center; gap:7px; color:#667085; text-decoration:none; font-size:11.5px; padding:5px 6px; border-radius:6px; }
.rail-signout:hover { color:#344054; background:#eaecf0; }
.auth-diagnostics-page { height:100vh; overflow:auto; padding:28px 32px 48px; background:#fbfcfd; box-sizing:border-box; }
.auth-diagnostics-header { max-width:1080px; margin:0 auto 22px; display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.auth-diagnostics-card { max-width:1080px; margin:0 auto; background:white; }
.diagnostic-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 34px; }
.diagnostic-grid > div { min-width:0; display:flex; flex-direction:column; gap:4px; padding:13px 0; border-bottom:1px solid #eef0f2; }
.diagnostic-grid span { color:#667085; font-size:11.5px; }
.diagnostic-grid strong { color:#20242b; font-size:13px; overflow-wrap:anywhere; }
.diagnostic-grid .mono { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:12px; font-weight:550; }
@media (max-width:780px) { .diagnostic-grid { grid-template-columns:1fr; } .landing-card { padding:36px 30px; } }

/* v0.17.9: regular-user Helpdesk shell + admin cleanup */
.session-pane-title {
  font-size: 15.5px;
  line-height: 1.25;
  font-weight: 700;
  color: #20242b;
  padding-top: 1px;
}

.rail-nav .mud-nav-group {
  margin-top: 6px;
}
.rail-nav .mud-nav-group .mud-nav-link {
  margin-left: 4px;
}

.test-skill-warning {
  width: min(700px, 80vw);
}
.skills-test-warning {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.trace-skill-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  background: #f2f4f7;
  color: #344054;
  font-size: 10.5px;
  line-height: 1.35;
}

.admin-page {
  height: 100vh;
  overflow: auto;
  padding: 26px 30px 50px;
  background: #fbfcfd;
}
.admin-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  max-width: 1250px;
  margin: 0 auto 22px;
}
.admin-card,
.admin-page > .mud-alert,
.usage-summary-grid,
.admin-section-title {
  max-width: 1250px;
  margin-left: auto;
  margin-right: auto;
}
.admin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 140px;
  color: #667085;
}
.usage-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.usage-summary-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #fff;
}
.usage-summary-card span {
  color: #667085;
  font-size: 12px;
}
.usage-summary-card strong {
  color: #111827;
  font-size: 24px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.admin-section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 22px;
  margin-bottom: 10px;
}
.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 12.5px;
}
.admin-table th,
.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #eaecf0;
  text-align: left;
  vertical-align: middle;
}
.admin-table th {
  color: #475467;
  background: #f8fafc;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.admin-table tbody tr:last-child td {
  border-bottom: 0;
}
.admin-table tbody tr:hover td {
  background: #fcfcfd;
}
.admin-session-title {
  min-width: 220px;
  max-width: 420px;
}
.admin-empty-cell {
  color: #667085;
  text-align: center !important;
  padding: 28px !important;
}
.admin-user-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-user-upn {
  color: #667085;
  font-size: 11px;
  margin-top: 2px;
}
.mode-pill {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  color: #475467;
  background: #f8fafc;
  font-size: 10.5px;
}

@media (max-width: 1000px) {
  .usage-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Agent dashboard: first modular operations source (Samsara overdue coaching). */
.agent-page { max-width: 1560px; margin: 0 auto; padding: 26px 30px 44px; height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.agent-page-header, .agent-source-title { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.agent-page-header { margin-bottom:20px; }
.agent-source-card { min-width: 0; }
.agent-source-title { padding-bottom:18px; border-bottom:1px solid #e4e7ec; }
.agent-loading { padding:32px 0; display:flex; align-items:center; gap:12px; color:#667085; }
.agent-summary-row { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin:20px 0; }
.agent-summary-stat { display:flex; flex-direction:column; gap:4px; background:#f7f9f8; border:1px solid #e4e7ec; border-radius:10px; padding:11px 18px; min-width:148px; }
.agent-summary-stat span, .agent-summary-meta { color:#667085; font-size:12px; }
.agent-summary-stat strong { color:#145a43; font-size:23px; line-height:1.2; }
.agent-summary-meta { margin-left:auto; display:flex; flex-direction:column; gap:4px; }
.agent-table-wrap { width:100%; overflow-x:auto; margin-top:16px; border:1px solid #e4e7ec; border-radius:10px; }
.agent-table { width:100%; min-width:890px; border-collapse:collapse; font-size:13px; }
.agent-table thead th { background:#f7f9f8; font-weight:600; color:#475467; text-align:left; padding:12px 13px; white-space:nowrap; }
.agent-table tbody td { padding:13px; border-top:1px solid #eaecf0; vertical-align:middle; }
.agent-table tbody tr:hover { background:#fafcfb; }
.agent-driver-cell strong { display:block; color:#243b33; }
.agent-driver-cell small { display:block; color:#888; margin-top:3px; }
.agent-overdue-pill { display:inline-block; padding:3px 8px; border-radius:12px; background:#fff0ed; color:#b42318; font-weight:600; white-space:nowrap; }
.agent-empty { color:#667085; text-align:center; padding:26px 12px; }
@media (max-width: 760px) { .agent-page { padding:16px 12px 28px; } .agent-page-header { flex-wrap:wrap; } .agent-summary-meta { margin-left:0; width:100%; } }
/* Agent dashboard: consistent filter strip, responsive with independently scrolling content. */
.agent-manager-filter { width:100%; }
.agent-manager-controls { display:flex; align-items:center; gap:20px; flex-wrap:wrap; }
@media (max-width:760px) { .agent-manager-controls > * { width:100%; } }

/* Agent2: independent, minimal driver roster page. Main shell scrolling remains unchanged. */
.agent2-page .agent2-managers { display:flex; flex-wrap:wrap; align-items:center; gap:9px; }
.agent2-page .agent2-manager-button { border-radius:999px; text-transform:none; min-width:72px; white-space:normal; }
.agent2-page .agent2-drivers-card { max-width:400px; }
.agent2-page .agent2-footnote { margin-bottom:36px; }
/* Agent2 metrics - intentionally scoped so the original Agent dashboard is unchanged. */
.agent2-page .agent2-metric-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.agent2-page .agent2-metric-card { min-width:0; }
.agent2-page .agent2-eta-combined-card { grid-column:span 2; }
.agent2-page .agent2-call-trace { font-size:.92rem; }

/* Card numbers open the card's Details popup. */
.agent2-page .agent2-card-value { all:unset; display:block; align-self:flex-start; border-radius:6px; cursor:pointer; }
.agent2-page .agent2-card-value:hover:not(:disabled) .mud-typography { text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:6px; }
.agent2-page .agent2-card-value:focus-visible { outline:2px solid var(--mud-palette-primary, #1976d2); outline-offset:3px; }
.agent2-page .agent2-card-value:disabled { cursor:default; }

/* Collapsible card sections and per-card move arrows (order saved per user). */
/* Each section is outlined as one group; its header is a tinted band. Collapsed sections shrink to a
   highlighted bar with a primary accent so they stand out from open ones. */
.agent2-page .agent2-section { border:1px solid var(--mud-palette-lines-default, #d6d6d6); border-radius:10px; padding:0 12px 12px;
  background:color-mix(in srgb, var(--mud-palette-text-primary, #000) 2%, transparent); }
.agent2-page .agent2-section-head { all:unset; display:flex; align-items:center; gap:6px; box-sizing:border-box;
  margin:0 -12px 12px; width:calc(100% + 24px); padding:8px 12px; cursor:pointer; border-radius:10px 10px 0 0;
  border-bottom:1px solid var(--mud-palette-lines-default, #d6d6d6); border-left:4px solid transparent;
  background:color-mix(in srgb, var(--mud-palette-text-primary, #000) 5%, transparent); }
.agent2-page .agent2-section-head:hover { background:color-mix(in srgb, var(--mud-palette-primary, #1976d2) 10%, transparent); }
.agent2-page .agent2-section-head:focus-visible { outline:2px solid var(--mud-palette-primary, #1976d2); outline-offset:2px; }
.agent2-page .agent2-section-collapsed { padding-bottom:0; border-color:color-mix(in srgb, var(--mud-palette-primary, #1976d2) 45%, transparent); }
.agent2-page .agent2-section-collapsed .agent2-section-head { margin-bottom:0; border-bottom:none; border-radius:10px;
  border-left-color:var(--mud-palette-primary, #1976d2); color:var(--mud-palette-primary, #1976d2);
  background:color-mix(in srgb, var(--mud-palette-primary, #1976d2) 8%, transparent); }
.agent2-page .agent2-section-collapsed .agent2-section-count { font-style:italic; }
.agent2-page .agent2-section-title { font-size:1.1rem; font-weight:600; }
/* Status & Filters panel: the update strip, Live Loads and filters stacked inside; collapsed to one line
   with the status and the selection (ellipsis when long; the full selection is the tooltip). */
.agent2-page .agent2-controls-body > *:last-child { margin-bottom:0 !important; }
.agent2-page .agent2-controls-summary { display:flex; align-items:center; gap:8px; flex:1 1 auto; min-width:0; margin-left:10px;
  font-size:.85rem; font-style:normal; color:var(--mud-palette-text-primary); white-space:nowrap; }
.agent2-page .agent2-controls-status { flex:none; font-weight:600; }
.agent2-page .agent2-controls-filters { min-width:0; overflow:hidden; text-overflow:ellipsis; color:var(--mud-palette-text-secondary); }
.agent2-page .agent2-controls-filters::before { content:"·"; margin-right:8px; }
.agent2-page .agent2-section-count { font-size:.85rem; margin-left:auto; }
.agent2-page .agent2-card-move { display:flex; gap:2px; margin:-10px -10px 0 -10px; }
/* Full Screen Preview (magnifier, opposite the move arrows). The previewed card itself becomes a fixed overlay
   over a dimmed backdrop; card-preview.js sets --agent2-preview-zoom so its content fills the window.
   z-index stays under MudBlazor popovers (1200) and dialogs (1400), so menus and the Details dialog open on top. */
.agent2-page .agent2-card-move .agent2-card-preview { margin-left:auto; }
.agent2-page .agent2-preview-backdrop { position:fixed; inset:0; z-index:1180; background:rgba(15, 23, 42, .55); }
.agent2-page .agent2-metric-card:has(> .agent2-card-previewing) {
  position:fixed; inset:16px; z-index:1190; margin:0; overflow:auto; overscroll-behavior:contain; overflow-anchor:none;
  padding:20px 32px 32px !important; box-shadow:0 24px 64px rgba(15, 23, 42, .35);
  background:var(--mud-palette-surface, #fff);
}
.agent2-page .agent2-metric-card:has(> .agent2-card-previewing) > :not(.agent2-card-previewing) { zoom:var(--agent2-preview-zoom, 1); }
.agent2-page .agent2-metric-card:has(> .agent2-card-previewing) .agent2-wchart-rows,
.agent2-page .agent2-metric-card:has(> .agent2-card-previewing) .agent2-revdm-scroll { max-height:none; overflow:visible; }
.agent2-page .agent2-card-previewing { position:sticky; top:0; z-index:1; margin:-20px -32px 0 -32px; padding:8px 8px 0;
  background:var(--mud-palette-surface, #fff); }
.agent2-page .agent2-card-move .mud-icon-button { padding:4px; }
/* Revenue to goal: delivered (solid) + planned (light) against the weekly goal. */
.agent2-page .agent2-goal-bar { position:relative; display:flex; height:10px; border-radius:5px; overflow:hidden;
  background:var(--mud-palette-lines-default, #e0e0e0); }
.agent2-page .agent2-goal-realized { background:var(--mud-palette-primary, #1976d2); }
.agent2-page .agent2-goal-planned { background:var(--mud-palette-primary, #1976d2); opacity:.38; }
.agent2-page .agent2-goal-mark { position:absolute; top:0; bottom:0; width:2px; background:var(--mud-palette-text-primary, #000); }
.agent2-page .agent2-goal-legend { display:flex; flex-wrap:wrap; gap:4px 14px; margin-top:6px; font-size:.85rem; }
.agent2-page .agent2-goal-swatch { display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:5px;
  background:var(--mud-palette-primary, #1976d2); vertical-align:-1px; }
.agent2-page .agent2-goal-swatch.planned { opacity:.38; }
/* Driver Revenue to Goal: full-width card (revenue by DM with the goal in the header);
   Delivered solid, Pending medium, Preassigned light. */
.agent2-page .agent2-full-card { grid-column:1 / -1; }
.agent2-page .agent2-revgoal-head { display:flex; flex-wrap:wrap; gap:16px 32px; justify-content:space-between; align-items:flex-start; }
.agent2-page .agent2-revgoal-main { flex:1 1 360px; min-width:0; }
.agent2-page .agent2-revgoal-side { flex:0 1 460px; min-width:260px; }
.agent2-page .agent2-revgoal-th { min-width:240px; }
.agent2-page .agent2-revgoal-chart { display:grid; gap:3px; min-width:240px; }
.agent2-page .agent2-revgoal-line { display:grid; grid-template-columns:58px minmax(90px,1fr) 46px; align-items:center; gap:6px; font-size:.72rem; }
.agent2-page .agent2-revgoal-key { color:var(--mud-palette-text-secondary, #666); }
.agent2-page .agent2-revgoal-track { display:flex; height:8px; border-radius:4px; overflow:hidden;
  background:color-mix(in srgb, var(--mud-palette-text-primary, #000) 8%, transparent); }
/* The segments sit in one inner bar that grows in from the left when the card renders. */
.agent2-page .agent2-revgoal-bar { display:flex; width:100%; height:100%; transform-origin:left center;
  animation:agent2-revgoal-grow .6s cubic-bezier(.2,.7,.2,1) both; }
@keyframes agent2-revgoal-grow { from { transform:scaleX(0); } to { transform:scaleX(1); } }
@media (prefers-reduced-motion:reduce) { .agent2-page .agent2-revgoal-bar { animation:none; } }
.agent2-page .agent2-revgoal-fill, .agent2-page .agent2-revgoal-short, .agent2-page .agent2-revgoal-over { flex:none; height:100%; }
/* Rounded cap on whichever segment ends the bar; a hairline seam where the solid part meets the pale / green part
   (the goal), so the goal reads without drawing a line. */
.agent2-page .agent2-revgoal-bar > span:last-child { border-radius:0 4px 4px 0; }
.agent2-page .agent2-revgoal-short, .agent2-page .agent2-revgoal-over { box-shadow:inset 1.5px 0 0 var(--mud-palette-surface, #fff); }
/* Past the right edge of the scale (over 200%): the green fades out instead of stopping flat. */
.agent2-page .agent2-revgoal-track.clipped .agent2-revgoal-over { border-radius:0;
  -webkit-mask-image:linear-gradient(to right, #000 55%, transparent); mask-image:linear-gradient(to right, #000 55%, transparent); }
/* No drivers of that type with a goal: a faint hatched track instead of an empty one. */
.agent2-page .agent2-revgoal-line.none .agent2-revgoal-track { background:repeating-linear-gradient(135deg,
  color-mix(in srgb, var(--mud-palette-text-primary, #000) 7%, transparent) 0 3px, transparent 3px 6px); }
.agent2-page .agent2-revgoal-line.none .agent2-revgoal-key, .agent2-page .agent2-revgoal-line.none .agent2-revgoal-pct { opacity:.55; }
.agent2-page .agent2-revdm-table tbody tr { transition:background-color .15s ease; }
.agent2-page .agent2-revdm-table tbody tr:hover { background:color-mix(in srgb, var(--mud-palette-primary, #1976d2) 5%, transparent); }
/* Short of goal: a pale version of the bar's own color up to the goal. Past goal: the Pending bar color (primary at .6), which sits
   with the steel blue, copper and the brand green. */
.agent2-page .agent2-revgoal-line.c .agent2-revgoal-short { background:color-mix(in srgb, #2f74b5 35%, #fff); }
.agent2-page .agent2-revgoal-line.o .agent2-revgoal-short { background:color-mix(in srgb, #c9702c 35%, #fff); }
.agent2-page .agent2-revgoal-over { background:var(--mud-palette-primary, #1976d2); opacity:.6; } /* same as the Pending bar */
.agent2-page .agent2-revgoal-good { color:#1f7a3f; }
.agent2-page .agent2-revgoal-bad { color:#c43c3c; }
.agent2-page .agent2-revgoal-line.c .agent2-revgoal-fill { background:#2f74b5; }
.agent2-page .agent2-revgoal-line.o .agent2-revgoal-fill { background:#c9702c; }
.agent2-page .agent2-revgoal-pct { text-align:right; font-variant-numeric:tabular-nums; font-weight:600; }
.agent2-page .agent2-revdm-d { background:var(--mud-palette-primary, #1976d2); }
.agent2-page .agent2-revdm-p { background:var(--mud-palette-primary, #1976d2); opacity:.6; }
.agent2-page .agent2-revdm-a { background:var(--mud-palette-primary, #1976d2); opacity:.3; }
.agent2-page .agent2-revdm-scroll { max-height:560px; overflow:auto; }
.agent2-page .agent2-revdm-table { width:100%; border-collapse:collapse; font-size:.85rem; }
.agent2-page .agent2-revdm-table th, .agent2-page .agent2-revdm-table td { padding:5px 6px; text-align:left; vertical-align:top;
  border-bottom:1px solid var(--mud-palette-lines-default, #e0e0e0); }
.agent2-page .agent2-revdm-table th { position:sticky; top:0; background:var(--mud-palette-surface, #fff); font-weight:600; }
.agent2-page .agent2-revdm-table .num { text-align:right; white-space:nowrap; }
.agent2-page .agent2-revdm-table tfoot td { font-weight:600; border-top:2px solid var(--mud-palette-lines-default, #e0e0e0); }
.agent2-page .agent2-revdm-split { display:block; font-size:.75rem; font-weight:400; color:var(--mud-palette-text-secondary, #666); }
@media(max-width:680px){.agent2-page .agent2-revdm-scroll{max-height:380px;}
  .agent2-page .agent2-revgoal-side{min-width:0; flex-basis:100%;}}

/* API Calls: fixed-height live strip + side drawer (cards never get pushed down). */
.agent2-page .agent2-call-strip { position:relative; overflow:hidden; transition:border-color .2s ease; }
.agent2-page .agent2-call-strip.loading { border-color:var(--mud-palette-primary, #1e6b52); }
.agent2-page .agent2-call-strip-row { display:flex; align-items:center; flex-wrap:wrap; gap:6px 12px; min-height:40px; }
.agent2-page .agent2-call-strip-status { flex:0 0 28px; display:flex; align-items:center; justify-content:center; }
.agent2-page .agent2-call-strip-text { flex:1 1 320px; min-width:0; display:flex; flex-direction:column; }
.agent2-page .agent2-call-strip-text .mud-typography { overflow:hidden; text-overflow:ellipsis; }
.agent2-page .agent2-call-strip-sources { display:flex; flex-wrap:wrap; gap:4px; margin-left:auto; }
/* Thin progress line along the strip's bottom edge, so it never shifts the layout. */
.agent2-page .agent2-call-strip-bar { position:absolute; left:0; right:0; bottom:0; height:3px;
  background:var(--mud-palette-lines-default, #e0e0e0); }
.agent2-page .agent2-call-strip-bar-fill { height:100%; background:var(--mud-palette-primary, #1e6b52);
  transition:width .4s ease; }
.agent2-page .agent2-call-strip-latest { display:flex; align-items:center; gap:6px; margin-top:4px; min-height:20px;
  padding-left:40px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.agent2-page .agent2-call-strip-latest span { overflow:hidden; text-overflow:ellipsis; }
.agent2-page .agent2-spin { animation: agent2-spin 1s linear infinite; }
@keyframes agent2-spin { to { transform: rotate(360deg); } }
.agent2-page .agent2-call-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.32); opacity:0; pointer-events:none;
  transition:opacity .2s ease; z-index:1290; }
.agent2-page .agent2-call-backdrop.open { opacity:1; pointer-events:auto; }
.agent2-page .agent2-call-drawer { position:fixed; top:0; right:0; height:100vh; width:min(620px, 100vw); z-index:1300;
  display:flex; flex-direction:column; background:var(--mud-palette-surface, #fff);
  border-left:1px solid var(--mud-palette-lines-default, #e0e0e0); box-shadow:-8px 0 24px rgba(0,0,0,.12);
  transform:translateX(100%); visibility:hidden; transition:transform .25s ease, visibility 0s linear .25s; }
.agent2-page .agent2-call-drawer.open { transform:none; visibility:visible; transition:transform .25s ease; }
.agent2-page .agent2-call-drawer-header { display:flex; align-items:flex-start; justify-content:space-between; gap:8px;
  padding:16px 16px 8px; }
.agent2-page .agent2-call-drawer-filters { display:flex; flex-wrap:wrap; gap:4px; padding:0 16px 8px;
  border-bottom:1px solid var(--mud-palette-lines-default, #e0e0e0); }
.agent2-page .agent2-call-drawer-body { flex:1; overflow-y:auto; padding:8px 16px 16px; }
@media (prefers-reduced-motion: reduce) {
  .agent2-page .agent2-spin { animation:none; }
  .agent2-page .agent2-call-strip-bar-fill { transition:none; }
  .agent2-page .agent2-call-drawer, .agent2-page .agent2-call-backdrop { transition:none; }
}
@media(max-width:1000px){.agent2-page .agent2-metric-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:680px){.agent2-page .agent2-metric-grid{grid-template-columns:1fr;} .agent2-page .agent2-eta-combined-card{grid-column:span 1;}}

/* ETA details use a genuine shrinkable two-column grid, not MudGrid's flex
   widths and negative gutters (which previously pushed captions outside cards). */
.agent2-page .agent2-eta-combined-card { min-width: 0; overflow: hidden; }
.agent2-page .agent2-eta-stats {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px; min-width: 0; width: 100%; max-width: 100%;
}
.agent2-page .agent2-eta-stat { min-width: 0; max-width: 100%; }
.agent2-page .agent2-eta-combined-card .mud-typography {
    display: block; max-width: 100%; min-width: 0;
    white-space: normal !important; overflow-wrap: anywhere; word-break: normal;
}
@media (max-width: 850px) {
    .agent2-page .agent2-eta-stats { grid-template-columns: minmax(0, 1fr); }
}

/* Agent live refresh: newly initiated requests appear gently without changing
   the Helpdesk trace panels. Honor reduced-motion accessibility preferences. */
.agent2-page .agent2-call-trace .mud-expand-panel { animation: agent-live-enter .22s ease-out both; }
@keyframes agent-live-enter {
  from { opacity: .35; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .agent2-page .agent2-call-trace .mud-expand-panel { animation: none; }
}

/* DM Scorecard AI summary + follow-up chat dialog. Dialogs render outside
   .agent2-page, so these rules are scoped by the dialog class instead. */
.agent2-ai-dialog .mud-dialog-content { padding-bottom:0; }
/* The scorecard scrolls inside .agent-page, so lock that as well as the document. */
html.agent-chat-scroll-lock, html.agent-chat-scroll-lock body, html.agent-chat-scroll-lock .agent-page { overflow:hidden !important; overscroll-behavior:none; }
.agent2-ai-dialog .agent2-ai-title { padding-right:40px; }
.agent2-ai-thread { display:flex; flex-direction:column; gap:12px; max-height:min(62vh, 720px); overflow-y:auto; padding:4px 4px 12px; }
.agent2-ai-bubble { border:1px solid var(--mud-palette-lines-default); border-radius:10px; padding:12px 14px 6px; background:var(--mud-palette-surface); }
.agent2-ai-bubble .markdown-body > :first-child { margin-top:0; }
.agent2-ai-bubble .markdown-body table { border-collapse:collapse; margin:8px 0; font-size:.88rem; display:block; overflow-x:auto; }
.agent2-ai-bubble .markdown-body th, .agent2-ai-bubble .markdown-body td { border:1px solid var(--mud-palette-lines-default); padding:4px 8px; text-align:left; }
.agent2-ai-bubble-foot { display:flex; align-items:center; gap:8px; margin-top:4px; }
.agent2-ai-user { align-self:flex-end; max-width:80%; white-space:pre-wrap; overflow-wrap:anywhere; padding:8px 12px; border-radius:10px 10px 2px 10px;
    background:var(--mud-palette-primary); color:var(--mud-palette-primary-text); }
.agent2-ai-tool { align-self:flex-start; max-width:100%; padding:8px 12px; border-left:3px solid var(--mud-palette-info); border-radius:4px;
    background:var(--mud-palette-background-gray); font-size:.88rem; }
.agent2-ai-tool-label { font-family:ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap:anywhere; }
.agent2-ai-tool-meta { color:var(--mud-palette-text-secondary); margin:2px 0 0 28px; }
.agent2-ai-tool-data { margin:4px 0 0 28px; }
.agent2-ai-tool-data summary { cursor:pointer; color:var(--mud-palette-primary); }
.agent2-ai-tool-data pre { max-height:260px; overflow:auto; margin:6px 0 0; padding:8px; font-size:.78rem; border-radius:4px; background:var(--mud-palette-surface); }
.agent2-ai-status { padding:4px 2px; }
.agent2-ai-suggestions { display:flex; flex-wrap:wrap; align-items:center; gap:4px; }
.agent2-ai-dialog .mud-dialog-actions { flex-direction:column; align-items:stretch; gap:4px; padding:8px 24px 16px; }
.agent2-ai-composer { display:flex; align-items:flex-end; gap:8px; }
/* .chat-composer is only there for Enter-to-send (composer-shortcuts.js); drop the Helpdesk card styling. */
.agent2-ai-composer.chat-composer { background:transparent; box-shadow:none; border-radius:0 !important; }
.agent2-ai-disclaimer { font-size:.72rem; }
.agent2-ai-dialog .agent2-call-spinner { display:inline-block; width:16px; height:16px; flex:none; border:2px solid var(--mud-palette-lines-default);
    border-top-color:var(--mud-palette-primary); border-radius:50%; animation:agent2-ai-spin .8s linear infinite; }
@keyframes agent2-ai-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .agent2-ai-dialog .agent2-call-spinner { animation:none; } }
@media (max-width: 600px) {
    .agent2-ai-thread { max-height:58vh; }
    .agent2-ai-user { max-width:92%; }
    .agent2-ai-dialog .mud-dialog-actions { padding:8px 12px 12px; }
}

/* Drivers - Working % card chart. Company = blue dot, Owner-Op = orange diamond
   (shape as well as color; palette validated for CVD). Rows: dumbbell per DM. */
/* Company = steel blue, Owner-Op = copper: muted to sit with the brand green (#145A43);
   validated for color-blind separation and >= 3:1 contrast on white. */
.agent2-page .agent2-wchart { --wc-company:#2f74b5; --wc-owner:#c9702c; --wc-unknown:#898781; --wc-neutral:#2f74b5; --wc-track:#e1e0d9; --wc-link:#c3c2b7;
    margin-top:12px; padding-top:10px; border-top:1px solid var(--mud-palette-lines-default); font-size:.8rem; }
.agent2-page .agent2-wchart-section { display:flex; justify-content:space-between; gap:8px; font-weight:600; color:var(--mud-palette-text-primary); margin-bottom:4px; }
.agent2-page .agent2-wchart-section--rows { margin-top:12px; }
.agent2-page .agent2-wchart-section .muted { font-weight:400; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.agent2-page .agent2-wchart-meter { display:grid; grid-template-columns:84px minmax(0,1fr) 40px 76px; align-items:center; gap:8px; padding:2px 0; }
.agent2-page .agent2-wchart-key { display:flex; align-items:center; gap:6px; color:var(--mud-palette-text-secondary); }
.agent2-page .agent2-wchart-track { position:relative; height:8px; border-radius:4px; background:var(--wc-track); overflow:hidden; }
.agent2-page .agent2-wchart-fill { position:absolute; inset:0 auto 0 0; border-radius:4px; }
.agent2-page .agent2-wchart-fill--c { background:var(--wc-company); }
.agent2-page .agent2-wchart-fill--o { background:var(--wc-owner); }
.agent2-page .agent2-wchart-value { text-align:right; font-variant-numeric:tabular-nums; font-weight:600; color:var(--mud-palette-text-primary); }
.agent2-page .agent2-wchart-n { text-align:right; font-variant-numeric:tabular-nums; color:var(--mud-palette-text-secondary); }
.agent2-page .agent2-wchart-note { margin-top:4px; color:var(--mud-palette-text-secondary); }
.agent2-page .agent2-wchart-mark { display:inline-block; width:9px; height:9px; flex:none; box-sizing:border-box; border:2px solid var(--mud-palette-surface); }
.agent2-page .agent2-wchart-mark--c { background:var(--wc-company); border-radius:50%; }
.agent2-page .agent2-wchart-mark--o { background:var(--wc-owner); border-radius:1px; transform:rotate(45deg) scale(.92); }
.agent2-page .agent2-wchart-key .agent2-wchart-mark { width:10px; height:10px; border:0; }
.agent2-page .agent2-wchart-axis { display:grid; grid-template-columns:minmax(0,112px) minmax(0,1fr) 48px; gap:8px; padding:0 2px;
    color:var(--mud-palette-text-secondary); font-size:.7rem; font-variant-numeric:tabular-nums; }
.agent2-page .agent2-wchart-ticks { position:relative; height:1.2em; }
.agent2-page .agent2-wchart-ticks span { position:absolute; left:0; }
.agent2-page .agent2-wchart-ticks span:nth-child(2) { left:50%; transform:translateX(-50%); }
.agent2-page .agent2-wchart-ticks span:nth-child(3) { left:auto; right:0; }
.agent2-page .agent2-wchart-rows { max-height:196px; overflow-y:auto; overscroll-behavior:contain; margin-right:-4px; padding-right:4px; }
.agent2-page .agent2-wchart-row { all:unset; box-sizing:border-box; width:100%; display:grid; grid-template-columns:minmax(0,112px) minmax(0,1fr) 48px;
    align-items:center; gap:8px; min-height:26px; padding:0 2px; border-radius:4px; cursor:pointer; }
.agent2-page .agent2-wchart-row:hover { background:var(--mud-palette-action-default-hover); }
.agent2-page .agent2-wchart-row:focus-visible { outline:2px solid var(--mud-palette-primary); outline-offset:-2px; }
.agent2-page .agent2-wchart-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--mud-palette-text-secondary); }
.agent2-page .agent2-wchart-plot { position:relative; height:14px;
    background:linear-gradient(var(--wc-track),var(--wc-track)) 0 50%/100% 1px no-repeat,
               linear-gradient(var(--wc-track),var(--wc-track)) 50% 0/1px 100% no-repeat; }
.agent2-page .agent2-wchart-link { position:absolute; top:50%; height:2px; margin-top:-1px; background:var(--wc-link); border-radius:1px; }
.agent2-page .agent2-wchart-dot { position:absolute; top:50%; width:11px; height:11px; margin:-5.5px 0 0 -5.5px; }
.agent2-page .agent2-wchart-dot.agent2-wchart-mark--o { transform:rotate(45deg) scale(.85); }
.agent2-page .agent2-wchart-row.is-top .agent2-wchart-name,
.agent2-page .agent2-wchart-row.is-selected .agent2-wchart-name { color:var(--mud-palette-text-primary); font-weight:600; }
.agent2-page .agent2-wchart-row.is-selected { background:var(--mud-palette-action-default-hover); }
.agent2-page .agent2-wchart-row.is-dim .agent2-wchart-plot { opacity:.35; }
.agent2-page .agent2-wchart-row.is-dim .agent2-wchart-value { color:var(--mud-palette-text-secondary); font-weight:400; }

/* Count layout: type share bar + stacked bar per DM (2px surface gaps between segments). */
.agent2-page .agent2-wchart-fill--u { background:var(--wc-unknown); }
.agent2-page .agent2-wchart-fill--n { background:var(--wc-neutral); }
.agent2-page .agent2-wchart-mark--u { background:var(--wc-unknown); border-radius:2px; }
.agent2-page .agent2-wchart-mark--n { background:var(--wc-neutral); border-radius:50%; }
.agent2-page .agent2-wchart-stack { display:flex; gap:2px; height:10px; min-width:0; }
.agent2-page .agent2-wchart-stack--share { height:10px; margin:2px 0 6px; }
.agent2-page .agent2-wchart-seg { flex-basis:0; min-width:3px; border-radius:2px; }
.agent2-page .agent2-wchart-seg:first-child { border-top-left-radius:4px; border-bottom-left-radius:4px; }
.agent2-page .agent2-wchart-seg:last-child { border-top-right-radius:4px; border-bottom-right-radius:4px; }
.agent2-page .agent2-wchart-bar { display:block; position:relative; height:14px; padding-top:2px;
    background:linear-gradient(var(--wc-track),var(--wc-track)) 0 0/1px 100% no-repeat; }
.agent2-page .agent2-wchart-legend { display:flex; flex-wrap:wrap; gap:4px 14px; color:var(--mud-palette-text-secondary); }
.agent2-page .agent2-wchart-legend > span { display:inline-flex; align-items:center; gap:5px; }
.agent2-page .agent2-wchart-legend b { color:var(--mud-palette-text-primary); font-weight:600; font-variant-numeric:tabular-nums; }
.agent2-page .agent2-wchart-legend .agent2-wchart-mark { width:10px; height:10px; border:0; }
.agent2-page .agent2-wchart-row:disabled { cursor:default; }
.agent2-page .agent2-wchart-row:disabled:hover { background:none; }
.agent2-page .agent2-wchart-row.is-dim .agent2-wchart-bar { opacity:.35; }
.agent2-page .agent2-wchart-value { white-space:nowrap; }
.agent2-page .agent2-metric-card .agent2-wchart { margin-top:auto; }

/* Notes on scorecard cards that are not populated yet; sit at the bottom of the card. */
.agent2-page .agent2-metric-card .agent2-card-note { margin-top:auto !important; }
.agent2-page .agent2-metric-card .agent2-card-note + .agent2-wchart { margin-top:12px; }

/* Bottom-left user row opens the profile dialog. */
.user-row-button { width:100%; border:0; background:transparent; padding:4px 6px; margin-top:6px; border-radius:8px;
  cursor:pointer; text-align:left; font:inherit; color:inherit; }
.user-row-button:hover { background:#eaecf0; }
.user-row-button:focus-visible { outline:2px solid var(--mud-palette-primary, #1e6b52); outline-offset:2px; }
.user-profile-head { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.user-profile-copy { min-width:0; }
.user-profile-copy .mud-typography { overflow-wrap:anywhere; }
.user-profile-facts { display:grid; grid-template-columns:max-content minmax(0,1fr); gap:4px 16px; margin:0 0 8px; font-size:14px; }
.user-profile-facts dt { color:#667085; }
.user-profile-facts dd { margin:0; overflow-wrap:anywhere; }
.user-profile-impersonate { display:flex; align-items:flex-start; gap:8px; margin-top:8px; }
.user-profile-impersonate .mud-button-root { margin-top:6px; }
.users-dm-cell { min-width:200px; }
.users-dm-picker { margin-top:4px; max-width:240px; }
/* DM Scorecard while impersonating a DM. */
.agent2-page .agent2-impersonation-banner { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }


/* Signed in with no page yet (/welcome) and its Admin → Landing editor. */
.welcome-page { display:flex; justify-content:center; padding:48px 16px; }
.welcome-card { max-width:620px; width:100%; }
.admin-landing-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px; align-items:start; }
@media (max-width:900px) { .admin-landing-layout { grid-template-columns:minmax(0,1fr); } }

/* DM Scorecard: Live Loads panel */
.agent2-page .agent2-live .mud-expand-panel { background:var(--mud-palette-surface, #fff); }
.agent2-page .agent2-live-title { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; width:100%; }
.agent2-page .agent2-live-title-text { flex:1 1 220px; min-width:0; }
.agent2-page .agent2-live-counts { display:flex; flex-wrap:wrap; gap:6px; }
.agent2-page .agent2-live-count { font-size:12px; font-weight:600; padding:3px 10px; border-radius:999px;
  background:var(--mud-palette-background-gray, #f2f4f7); color:var(--mud-palette-text-secondary, #475467); white-space:nowrap; }
.agent2-page .agent2-live-count.late { background:#fef3f2; color:#b42318; }
.agent2-page .agent2-live-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; margin-bottom:14px; }
.agent2-page .agent2-live-search { flex:1 1 280px; max-width:440px; margin:0 !important; }
.agent2-page .agent2-live-spacer { flex:1 1 auto; }
.agent2-page .agent2-live-loading { display:flex; align-items:center; gap:10px; padding:8px 2px 14px; }
.agent2-page .agent2-live-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(320px, 1fr)); gap:12px; }
.agent2-page .agent2-live-card { display:flex; flex-direction:column; gap:10px; padding:14px 14px 12px; border-radius:10px;
  background:var(--mud-palette-surface, #fff); border:1px solid var(--mud-palette-lines-default, #e4e7ec);
  box-shadow:0 1px 2px rgba(16,24,40,.05); transition:box-shadow .15s ease, border-color .15s ease; min-width:0; }
.agent2-page .agent2-live-card:hover { box-shadow:0 4px 12px rgba(16,24,40,.08); }
.agent2-page .agent2-live-card.late { border:2px solid var(--mud-palette-error, #d92d20); padding:13px 13px 11px;
  box-shadow:0 0 0 3px rgba(217,45,32,.08); }
.agent2-page .agent2-live-card-head { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.agent2-page .agent2-live-order { font-size:12px; font-weight:600; letter-spacing:.02em; color:var(--mud-palette-text-secondary, #667085); }
.agent2-page .agent2-live-customer { font-size:15px; font-weight:600; line-height:1.3; overflow:hidden; text-overflow:ellipsis;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.agent2-page .agent2-live-status { flex:none; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em;
  padding:3px 8px; border-radius:6px; white-space:nowrap; }
.agent2-page .agent2-live-status.late { background:#fef3f2; color:#b42318; }
.agent2-page .agent2-live-status.warn { background:#fffaeb; color:#b54708; }
.agent2-page .agent2-live-status.ok { background:#ecfdf3; color:#067647; }
.agent2-page .agent2-live-status.none { background:#f2f4f7; color:#475467; }
.agent2-page .agent2-live-assign { display:flex; flex-wrap:wrap; gap:4px 14px; font-size:13px; }
.agent2-page .agent2-live-assign > span { display:inline-flex; align-items:center; gap:4px; min-width:0; }
.agent2-page .agent2-live-route { display:grid; grid-template-columns:1fr 18px 1fr; align-items:start; gap:6px;
  padding:10px; border-radius:8px; background:var(--mud-palette-background-gray, #f8fafc); }
.agent2-page .agent2-live-route-line { align-self:center; height:2px; background:var(--mud-palette-lines-default, #d0d5dd); position:relative; }
.agent2-page .agent2-live-route-line::after { content:""; position:absolute; right:-1px; top:-3px; border:4px solid transparent;
  border-left-color:var(--mud-palette-lines-default, #d0d5dd); border-right:0; }
.agent2-page .agent2-live-stop { min-width:0; font-size:12px; line-height:1.35; }
.agent2-page .agent2-live-stop-label { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.04em; color:var(--mud-palette-text-secondary, #667085); }
.agent2-page .agent2-live-stop-place { font-size:13px; font-weight:600; }
.agent2-page .agent2-live-stop-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.agent2-page .agent2-live-next { font-size:12px; padding:6px 10px; border-radius:6px; background:#f0f9ff; color:#026aa2; }
.agent2-page .agent2-live-next.late { background:#fef3f2; color:#b42318; }
.agent2-page .agent2-live-gps { display:flex; align-items:flex-start; gap:8px; font-size:12px; padding-top:8px;
  border-top:1px dashed var(--mud-palette-lines-default, #e4e7ec); }
.agent2-page .agent2-live-gps.none { align-items:center; }
.agent2-page .agent2-live-gps-text { flex:1; min-width:0; }
.agent2-page .agent2-live-coords { font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:13px; font-weight:600; }
.agent2-page .agent2-live-address { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.agent2-page .agent2-live-map { flex:none; font-weight:600; color:var(--mud-palette-primary, #1e6b52); text-decoration:none;
  padding:2px 8px; border:1px solid currentColor; border-radius:6px; }
.agent2-page .agent2-live-map:hover { text-decoration:underline; }
.agent2-page .agent2-live-foot { font-size:12px; }
@media (max-width: 520px) {
  .agent2-page .agent2-live-grid { grid-template-columns:1fr; }
  .agent2-page .agent2-live-route { grid-template-columns:1fr; }
  .agent2-page .agent2-live-route-line { display:none; }
}

/* DM Scorecard: Loads on Hold reason chips */
.agent2-page .agent2-hold-reasons { display:flex; flex-wrap:wrap; gap:4px; margin:6px 0 4px; }
.agent2-page .agent2-hold-reason { font-size:11px; padding:2px 8px; border-radius:999px; max-width:100%;
  background:var(--mud-palette-background-gray, #f2f4f7); color:var(--mud-palette-text-secondary, #475467);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.agent2-page .agent2-hold-reason b { margin-left:2px; color:var(--mud-palette-text-primary, #101828); }

/* DM Scorecard: driver filter bubbles grow to fit every driver (no inner scroll bar) */
.agent2-page .agent2-driver-count { font-size:13px; font-weight:400; }

/* Users page: Add user */
.users-add .users-add-email { flex:1 1 280px; max-width:360px; margin:0 !important; }
.users-add .users-add-name { flex:1 1 200px; max-width:280px; margin:0 !important; }

/* DM Scorecard: Live Loads contributing factors */
.agent2-page .agent2-live-card.risk-open { grid-column:1 / -1; }
.agent2-page .agent2-risk-start { padding-top:2px; }
.agent2-page .agent2-risk { display:flex; flex-direction:column; gap:12px; padding-top:10px; border-top:1px dashed var(--mud-palette-lines-default, #e4e7ec); }
.agent2-page .agent2-risk-head { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.agent2-page .agent2-risk-count { display:flex; align-items:center; justify-content:center; width:56px; height:56px; border-radius:50%; flex:none; color:#fff; background:#475467; font-size:26px; font-weight:700; line-height:1; }
.agent2-page .agent2-risk-names { font-size:13px; line-height:1.35; margin-top:1px; }
.agent2-page .agent2-risk-summary { flex:1 1 260px; min-width:0; }
.agent2-page .agent2-risk-reason { font-size:15px; font-weight:600; line-height:1.35; }
.agent2-page .agent2-risk-meta { font-size:12px; margin-top:2px; }
.agent2-page .agent2-risk-actions { display:flex; align-items:center; gap:2px; margin-left:auto; }
.agent2-page .agent2-risk-route { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:8px; padding:10px 12px; border-radius:8px; background:var(--mud-palette-background-gray, #f8fafc); }
.agent2-page .agent2-risk-route > div { display:flex; flex-direction:column; font-size:12px; min-width:0; }
.agent2-page .agent2-risk-route b { font-size:14px; }
.agent2-page .agent2-risk-bad { color:#b42318; }
.agent2-page .agent2-risk-body { display:grid; grid-template-columns:minmax(0, 5fr) minmax(0, 7fr); gap:20px; }
.agent2-page .agent2-risk-subhead { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--mud-palette-text-secondary, #667085); margin-bottom:6px; }
.agent2-page .agent2-risk-explain { font-size:12px; line-height:1.35; margin-bottom:6px; }
.agent2-page .agent2-risk-factor { display:grid; grid-template-columns:12px minmax(0, 1fr) auto; align-items:center; gap:2px 8px; padding:5px 0; font-size:13px; }
.agent2-page .agent2-risk-dot { width:10px; height:10px; border-radius:50%; box-sizing:border-box; }
.agent2-page .agent2-risk-factor.present .agent2-risk-dot { background:#475467; }
.agent2-page .agent2-risk-factor.clear .agent2-risk-dot { border:2px solid #98a2b3; }
.agent2-page .agent2-risk-factor.not-checked .agent2-risk-dot { border:2px dashed #98a2b3; }
.agent2-page .agent2-risk-cname { font-weight:600; }
.agent2-page .agent2-risk-state { font-size:12px; color:var(--mud-palette-text-secondary, #667085); }
.agent2-page .agent2-risk-factor.present .agent2-risk-state { font-weight:600; color:var(--mud-palette-text-primary, #15181d); }
.agent2-page .agent2-risk-cdetail { grid-column:1 / -1; font-size:12px; line-height:1.3; }
.agent2-page .agent2-risk-event { display:grid; grid-template-columns:118px auto minmax(0, 1fr); align-items:start; gap:8px; padding:5px 0; font-size:13px; border-bottom:1px solid var(--mud-palette-lines-default, #f2f4f7); }
.agent2-page .agent2-risk-event.faded { opacity:.55; }
.agent2-page .agent2-risk-when { font-weight:600; font-size:12px; display:flex; flex-direction:column; }
.agent2-page .agent2-risk-when small { font-weight:400; color:var(--mud-palette-text-secondary, #667085); }
.agent2-page .agent2-risk-kind { font-size:11px; font-weight:700; padding:2px 8px; border-radius:6px; white-space:nowrap; background:#f2f4f7; color:#344054; }
.agent2-page .agent2-risk-kind.traffic.major, .agent2-page .agent2-risk-kind.traffic.critical, .agent2-page .agent2-risk-kind.traffic.severe,
.agent2-page .agent2-risk-kind.weather.extreme, .agent2-page .agent2-risk-kind.weather.severe { background:#fef3f2; color:#b42318; }
.agent2-page .agent2-risk-kind.traffic.moderate, .agent2-page .agent2-risk-kind.traffic.heavy, .agent2-page .agent2-risk-kind.weather.moderate { background:#fffaeb; color:#b54708; }
.agent2-page .agent2-risk-kind.weather.forecast { background:#f0f9ff; color:#026aa2; }
.agent2-page .agent2-risk-text { min-width:0; line-height:1.35; }
.agent2-page .agent2-risk-none { font-size:12px; padding:2px 0 4px; }
.agent2-page .agent2-risk-finding { font-size:13px; padding:3px 0; }
.agent2-page .agent2-risk-notes { font-size:11px; line-height:1.5; }
@media (max-width: 760px) {
  .agent2-page .agent2-risk-body { grid-template-columns:1fr; }
  .agent2-page .agent2-risk-event { grid-template-columns:96px minmax(0, 1fr); }
  .agent2-page .agent2-risk-event .agent2-risk-text { grid-column:1 / -1; }
}

/* Live Loads contributing factors: folded count badge */
.agent2-page .agent2-risk-mini { display:flex; align-items:center; gap:10px; width:100%; padding:8px 0 0; border:0; border-top:1px dashed var(--mud-palette-lines-default, #e4e7ec);
  background:none; font:inherit; color:inherit; text-align:left; cursor:pointer; }
.agent2-page .agent2-risk-mini:hover .agent2-risk-mini-reason { text-decoration:underline; }
.agent2-page .agent2-risk-count.small { width:40px; height:40px; font-size:18px; }
.agent2-page .agent2-risk-mini-text { display:flex; flex-direction:column; min-width:0; font-size:12px; line-height:1.35; }
.agent2-page .agent2-risk-mini-reason { font-size:13px; font-weight:600; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }

/* Regions page (Admin > Regions): region cards with drag-and-drop terminals. */
.regions-add .regions-add-name { flex:1 1 240px; max-width:320px; margin:0 !important; }
.regions-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:16px; align-items:start; }
.regions-card { padding:12px; display:flex; flex-direction:column; gap:8px; }
.regions-card-none { border-style:dashed !important; }
.regions-card-head { display:flex; align-items:center; gap:4px; min-height:40px; }
.regions-card-title { flex:1; display:flex; flex-direction:column; min-width:0; }
.regions-card-title .muted { font-size:.75rem; }
.regions-rename { flex:1; margin:0 !important; }
.regions-zone { min-height:48px; display:flex; flex-direction:column; gap:6px; border-radius:8px; padding:4px; transition:background-color .15s; }
.regions-zone.mud-drop-zone-drag-block, .regions-grid .mud-drop-zone-can-drop { background:rgba(var(--mud-palette-primary-rgb), .06); outline:1px dashed var(--mud-palette-primary); }
.regions-terminal { display:flex; align-items:center; gap:6px; padding:4px 4px 4px 6px; border:1px solid var(--mud-palette-lines-default); border-radius:8px; background:var(--mud-palette-surface); cursor:grab; }
.regions-terminal:active { cursor:grabbing; }
.regions-drag { color:var(--mud-palette-text-disabled); }
.regions-terminal-text { flex:1; display:flex; flex-direction:column; min-width:0; line-height:1.2; }
.regions-terminal-text .muted { font-size:.72rem; }

/* Admin > Settings */
.admin-settings-card { max-width:760px; }
.admin-settings-number { max-width:260px; margin:0 !important; }

/* Admin > Options: tabs (Users, Regions, Landing, Settings) inside one .admin-page. The tab strip and every
   block in a tab share the page header's 1250px column. */
.admin-options-tabs,
.admin-options-panel {
  max-width: 1250px;
  margin-left: auto;
  margin-right: auto;
}
.admin-options-tabs { margin-bottom: 20px; }
/* Options uses the full window width: the Users table gains a column per area and scope. */
.admin-options-page .admin-page-header,
.admin-options-page .admin-options-tabs,
.admin-options-page .admin-options-panel,
.admin-options-page .admin-card,
.admin-options-page > .mud-alert { max-width: none; }

/* Users tab: an area's level and its scope list (Regions, Terminals, Branches...) side by side, half each.
   The scope label floats above its box, so the boxes align on their bottom edge. */
.users-area-row { display:flex; flex-wrap:wrap; align-items:flex-end; gap:4px 8px; }
.users-area-row:has(> .users-scope) { min-width:340px; }
.users-area-row > .users-level,
.users-area-row > .users-scope { flex:1 1 0; min-width:0; margin-top:0 !important; margin-bottom:0 !important; }
.users-area-row > .mud-typography-caption { flex-basis:100%; }
