:root {
  --ledger-bg: #f4f7fa;
  --ledger-surface: #ffffff;
  --ledger-fg: #17212b;
  --ledger-muted: #65717d;
  --ledger-border: #d9e0e6;
  --ledger-border-strong: #bec9d2;
  --ledger-navy: #123653;
  --ledger-navy-hover: #1d4869;
  --ledger-navy-soft: #eaf0f5;
  --ledger-ready: #28764a;
  --ledger-ready-soft: #eef7f1;
  --ledger-attention: #a96b08;
  --ledger-attention-soft: #fbf4e8;
  --ledger-danger: #a33b3b;
  --ledger-danger-soft: #fbefef;
  --ledger-mono: "Cascadia Mono", "JetBrains Mono", "IBM Plex Mono", Consolas, monospace;
  --ledger-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --ledger-font-micro: 11px;
  --ledger-font-caption: 12px;
  --ledger-font-body: 14px;
  --ledger-font-control: 14px;
  --ledger-header-height: 64px;
}

body[data-view="portal"],
body[data-view="admin-console"],
body[data-view="auth"],
body[data-view="forbidden"],
body[data-view="account"],
body[data-view="notifications"],
body[data-view="large-upload"] {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ledger-bg);
  color: var(--ledger-fg);
  font-family: var(--ledger-sans);
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.ledger-site-header,
.ledger-site-header *,
.ledger-page,
.ledger-page * {
  box-sizing: border-box;
}

.ledger-site-header {
  position: relative;
  z-index: 100;
  display: grid;
  min-height: var(--ledger-header-height);
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: stretch;
  border-bottom: 1px solid #294a65;
  background: var(--ledger-navy);
  color: var(--ledger-surface);
}

.ledger-site-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--ledger-surface);
  padding: 0 18px;
  text-decoration: none;
  white-space: nowrap;
}

.ledger-site-brand span {
  font-family: var(--ledger-mono);
  font-size: var(--ledger-font-micro);
  font-weight: 650;
  letter-spacing: 0.07em;
}

.ledger-site-brand strong {
  overflow: hidden;
  font-size: 18px;
  font-weight: 700;
  text-overflow: ellipsis;
}

.ledger-site-nav {
  display: flex;
  min-width: 0;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}

.ledger-site-nav::-webkit-scrollbar {
  display: none;
}

.ledger-site-nav a {
  display: inline-flex;
  min-height: var(--ledger-header-height);
  flex: 0 0 auto;
  align-items: center;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  padding: 0 16px;
  font-size: var(--ledger-font-control);
  font-weight: 520;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.ledger-site-nav a:hover,
.ledger-site-nav a.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.ledger-site-account {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
}

.ledger-site-account > a:first-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
  color: #ffffff;
  line-height: 1.25;
  text-decoration: none;
}

.ledger-site-account > a:first-child span {
  max-width: 120px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-site-account > a:first-child small,
.ledger-site-context {
  color: rgba(255, 255, 255, 0.58);
  font-family: var(--ledger-mono);
  font-size: var(--ledger-font-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ledger-site-signout {
  display: grid;
  min-width: 36px;
  min-height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff !important;
  font-size: var(--ledger-font-micro);
  text-decoration: none;
}

.ledger-page {
  min-height: calc(100svh - var(--ledger-header-height));
  padding: 22px clamp(18px, 2.8vw, 42px) 30px;
}

.ledger-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 17px;
  border-bottom: 2px solid var(--ledger-navy);
}

.ledger-title-row p,
.drawer-kicker {
  margin: 0 0 5px;
  color: var(--ledger-muted);
  font-family: var(--ledger-mono);
  font-size: var(--ledger-font-micro);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.ledger-title-row h1 {
  margin: 0;
  color: var(--ledger-fg);
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.ledger-title-actions,
.ledger-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ledger-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--ledger-border-strong);
  border-radius: 3px;
  background: var(--ledger-surface);
  color: var(--ledger-fg);
  padding: 0 13px;
  font: 600 var(--ledger-font-control)/1 var(--ledger-sans);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
}

.ledger-button:hover:not(:disabled) {
  border-color: var(--ledger-navy);
  background: var(--ledger-bg);
}

.ledger-button.is-dark {
  border-color: var(--ledger-navy);
  background: var(--ledger-navy);
  color: #ffffff;
}

.ledger-button.is-dark:hover {
  background: var(--ledger-navy-hover);
  color: #ffffff;
}

.ledger-button.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.ledger-button svg,
.ledger-detail-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ledger-button.is-loading svg {
  animation: ledger-spin 0.85s linear infinite;
}

@keyframes ledger-spin {
  to { transform: rotate(360deg); }
}

.ledger-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
}

.ledger-field {
  position: relative;
  display: block;
}

.ledger-field svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ledger-muted);
  stroke-width: 1.8;
  transform: translateY(-50%);
}

.ledger-field input,
.ledger-field select {
  height: 44px;
  border: 1px solid var(--ledger-border-strong);
  border-radius: 3px;
  outline: 0;
  background: var(--ledger-surface);
  color: var(--ledger-fg);
  font: var(--ledger-font-control) var(--ledger-sans);
}

.ledger-field input:focus,
.ledger-field select:focus {
  border-color: var(--ledger-navy);
  box-shadow: 0 0 0 2px rgba(18, 54, 83, 0.1);
}

.ledger-field input {
  width: 270px;
  padding: 0 12px;
}

.ledger-field.has-icon input {
  padding-left: 38px;
}

.ledger-field select {
  min-width: 132px;
  padding: 0 30px 0 11px;
}

.ledger-record-count {
  color: var(--ledger-muted);
  font: var(--ledger-font-caption) var(--ledger-mono);
  white-space: nowrap;
}

.ledger-record-count strong {
  color: var(--ledger-fg);
}

.ledger-status {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 10px;
  font-size: var(--ledger-font-caption);
  font-weight: 700;
  white-space: nowrap;
}

.ledger-status > span:first-child {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.ledger-status b {
  font: inherit;
}

.ledger-status.status-ok { background: var(--ledger-ready-soft); color: var(--ledger-ready); }
.ledger-status.status-degraded { background: var(--ledger-attention-soft); color: var(--ledger-attention); }
.ledger-status.status-down { background: var(--ledger-danger-soft); color: var(--ledger-danger); }
.ledger-status.status-unknown,
.ledger-status.status-checking { background: var(--ledger-bg); color: var(--ledger-muted); }

/* Product-aware web inbox */
.notification-ledger-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  color: var(--ledger-muted);
  font-size: var(--ledger-font-caption);
}

.notification-ledger-summary p { margin: 0; }
.notification-ledger-summary strong { color: var(--ledger-fg); }

.notification-ledger-list {
  border: 1px solid var(--ledger-border);
  background: var(--ledger-surface);
}

.notification-ledger-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--ledger-border);
}

.notification-ledger-item:last-child { border-bottom: 0; }
.notification-ledger-item.is-unread { box-shadow: inset 3px 0 var(--ledger-navy); }

.notification-ledger-product {
  color: var(--ledger-muted);
  font: 600 var(--ledger-font-micro)/1.4 var(--ledger-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.notification-ledger-copy { min-width: 0; }
.notification-ledger-copy h2 { margin: 0 0 5px; font-size: 17px; line-height: 1.35; }
.notification-ledger-copy p { margin: 0; color: var(--ledger-muted); font-size: var(--ledger-font-body); }
.notification-ledger-copy time { display: block; margin-top: 7px; color: var(--ledger-muted); font: var(--ledger-font-micro) var(--ledger-mono); }

.notification-ledger-action {
  min-width: 92px;
}

.notification-ledger-action[hidden] { display: none; }

.notification-ledger-empty {
  margin: 0;
  padding: 54px 24px;
  color: var(--ledger-muted);
  text-align: center;
}

/* Portal ledger */
.portal-ledger-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  border: 1px solid var(--ledger-border);
  background: var(--ledger-surface);
}

.portal-ledger-table-wrap {
  min-width: 0;
}

.portal-ledger-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--ledger-font-body);
}

.portal-ledger-table caption {
  padding: 11px 13px;
  border-bottom: 1px solid var(--ledger-border);
  color: var(--ledger-muted);
  font-size: var(--ledger-font-caption);
  text-align: left;
}

.portal-ledger-table th,
.portal-ledger-table td {
  padding: 12px 13px;
  border-right: 1px solid var(--ledger-border);
  border-bottom: 1px solid var(--ledger-border);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.portal-ledger-table th:last-child,
.portal-ledger-table td:last-child {
  border-right: 0;
}

.portal-ledger-table thead th {
  height: 43px;
  background: var(--ledger-bg);
  color: var(--ledger-muted);
  font: 550 var(--ledger-font-micro) var(--ledger-mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.portal-ledger-table .col-code { width: 82px; }
.portal-ledger-table .col-system { width: 174px; }
.portal-ledger-table .col-status { width: 118px; }
.portal-ledger-table .col-time { width: 116px; }
.portal-ledger-table .col-detail { width: 60px; }

.portal-group-row th {
  padding: 9px 13px;
  background: #f3f4f5;
  color: var(--ledger-navy);
  font: 650 var(--ledger-font-caption) var(--ledger-mono);
  letter-spacing: 0.06em;
}

.portal-record-row {
  background: var(--ledger-surface);
  cursor: pointer;
}

.portal-record-row:hover,
.portal-record-row.is-selected {
  background: #f8fbfd;
}

.portal-record-row.is-selected td:first-child {
  box-shadow: inset 3px 0 var(--ledger-navy);
}

.record-code,
.record-checked {
  color: var(--ledger-muted);
  font: var(--ledger-font-caption) var(--ledger-mono);
}

.record-system strong,
.record-system span {
  display: block;
}

.record-system strong {
  color: var(--ledger-fg);
  font-size: var(--ledger-font-body);
  font-weight: 700;
}

.record-system span {
  margin-top: 3px;
  color: var(--ledger-muted);
  font-size: var(--ledger-font-caption);
}

.ledger-detail-button {
  display: grid;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--ledger-border-strong);
  border-radius: 2px;
  background: var(--ledger-surface);
  color: var(--ledger-fg);
  cursor: pointer;
}

.ledger-detail-button:hover {
  border-color: var(--ledger-navy);
  background: var(--ledger-bg);
}

.portal-record-drawer {
  min-width: 0;
  padding: 18px;
  border-left: 1px solid var(--ledger-border);
  background: var(--ledger-bg);
}

.portal-record-drawer h2 {
  margin: 0;
  color: var(--ledger-fg);
  font-size: 26px;
  font-weight: 680;
}

.drawer-description {
  margin: 9px 0 16px;
  color: var(--ledger-muted);
  font-size: var(--ledger-font-body);
  line-height: 1.65;
}

.drawer-data {
  margin: 18px 0;
  border-top: 1px solid var(--ledger-border);
}

.drawer-data div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ledger-border);
  font-size: 13px;
}

.drawer-data dt { color: var(--ledger-muted); }
.drawer-data dd { margin: 0; color: var(--ledger-fg); font-weight: 650; text-align: right; }
.drawer-actions { display: grid; gap: 8px; }
.drawer-actions .ledger-button { width: 100%; }
.drawer-guide,
.drawer-note { color: var(--ledger-muted); font-size: var(--ledger-font-caption); line-height: 1.65; }
.drawer-guide { padding: 10px; border: 1px solid var(--ledger-border); background: var(--ledger-surface); }
.drawer-note { margin: 16px 0 0; }
.portal-empty-state { margin: 0; padding: 34px 16px; color: var(--ledger-muted); text-align: center; }

/* Shared administration shell */
body[data-view="admin-console"] .admin-global-header,
body[data-view="admin-console"] .admin-sidebar,
body[data-view="admin-console"] .admin-sidebar-backdrop {
  display: none !important;
}

.ledger-admin-subnav {
  display: flex;
  min-height: 42px;
  align-items: stretch;
  overflow-x: auto;
  border-bottom: 1px solid var(--ledger-border);
  background: var(--ledger-surface);
  padding: 0 clamp(18px, 2.8vw, 42px);
  scrollbar-width: none;
}

.ledger-admin-subnav a {
  display: inline-flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  border-right: 1px solid var(--ledger-border);
  color: var(--ledger-muted);
  padding: 0 14px;
  font-size: var(--ledger-font-caption);
  font-weight: 600;
  text-decoration: none;
}

.ledger-admin-subnav a:first-child { border-left: 1px solid var(--ledger-border); }
.ledger-admin-subnav a:hover,
.ledger-admin-subnav a.is-active { background: var(--ledger-navy-soft); color: var(--ledger-navy); }

body[data-view="admin-console"] .admin-workspace {
  width: 100%;
  min-height: calc(100svh - 100px);
  margin: 0 !important;
  background: var(--ledger-bg);
}

body[data-view="admin-console"] .admin-page-header {
  position: static;
  display: flex;
  width: auto;
  max-width: none;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 clamp(18px, 2.8vw, 42px);
  border: 0;
  border-bottom: 2px solid var(--ledger-navy);
  background: transparent;
  padding: 22px 0 17px;
}

body[data-view="admin-console"] .admin-page-header h1 {
  margin: 0;
  color: var(--ledger-fg);
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

body[data-view="admin-console"] .admin-page-header p {
  margin: 7px 0 0;
  color: var(--ledger-muted);
  font-size: 13px;
}

body[data-view="admin-console"] .admin-main {
  max-width: none;
  margin: 0;
  padding: 16px clamp(18px, 2.8vw, 42px) 30px;
  font-size: var(--ledger-font-body);
  line-height: 1.55;
}

body[data-view="admin-console"] .admin-panel,
body[data-view="admin-console"] .account-panel,
body[data-view="admin-console"] .maintenance-panel,
body[data-view="admin-console"] .component-panel,
body[data-view="admin-console"] .diagnostics-panel,
body[data-view="admin-console"] .release-panel,
body[data-view="admin-console"] .flow-section,
body[data-view="admin-console"] .flow-card,
body[data-view="admin-console"] .factory-primary-panel,
body[data-view="admin-console"] .factory-callout,
body[data-view="admin-console"] .factory-result-panel,
body[data-view="admin-console"] .factory-next-actions,
body[data-view="admin-console"] .agent-management,
body[data-view="admin-console"] .safety-card,
body[data-view="admin-console"] .secret-card {
  border-color: var(--ledger-border) !important;
  border-radius: 2px !important;
  background: var(--ledger-surface);
  box-shadow: none !important;
}

body[data-view="admin-console"] .primary-button,
body[data-view="admin-console"] .secondary-button,
body[data-view="admin-console"] .danger-button,
body[data-view="admin-console"] .admin-secondary-action,
body[data-view="admin-console"] .account-edit-button,
body[data-view="admin-console"] button,
body[data-view="admin-console"] select,
body[data-view="admin-console"] input,
body[data-view="admin-console"] textarea {
  border-radius: 3px !important;
  font-family: var(--ledger-sans);
  font-size: 13px;
}

body[data-view="admin-console"] .primary-button {
  border-color: var(--ledger-navy) !important;
  background: var(--ledger-navy) !important;
}

body[data-view="admin-console"] table {
  border-collapse: collapse;
  font-size: var(--ledger-font-body);
}

body[data-view="admin-console"] table th {
  background: var(--ledger-bg) !important;
  color: var(--ledger-muted) !important;
  font-family: var(--ledger-mono);
  font-size: var(--ledger-font-micro) !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body[data-view="admin-console"] table th,
body[data-view="admin-console"] table td {
  border-color: var(--ledger-border) !important;
}

body[data-view="admin-console"] .section-eyebrow,
body[data-view="admin-console"] .admin-eyebrow,
body[data-view="admin-console"] .task-label,
body[data-view="admin-console"] .factory-kicker,
body[data-view="admin-console"] .agent-eyebrow {
  color: var(--ledger-muted) !important;
  font-family: var(--ledger-mono) !important;
  font-size: var(--ledger-font-micro) !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Authentication, account and utility pages */
body[data-view="auth"] .auth-shell,
body[data-view="forbidden"] .auth-shell {
  display: grid;
  min-height: calc(100svh - var(--ledger-header-height));
  place-items: center;
  padding: 28px 16px;
}

body[data-view="auth"] .auth-panel,
body[data-view="forbidden"] .auth-panel {
  width: min(100%, 480px);
  border: 1px solid var(--ledger-border);
  border-top: 3px solid var(--ledger-navy);
  border-radius: 0;
  background: var(--ledger-surface);
  box-shadow: none;
  padding: 30px;
}

body[data-view="auth"] .auth-panel h1,
body[data-view="forbidden"] .auth-panel h1 {
  margin: 0 0 8px;
  color: var(--ledger-fg);
  font-size: 28px;
  font-weight: 680;
  letter-spacing: -0.025em;
}

body[data-view="auth"] .auth-panel > p,
body[data-view="forbidden"] .auth-panel > p {
  color: var(--ledger-muted);
}

body[data-view="auth"] .auth-form input {
  min-height: 42px;
  border-color: var(--ledger-border-strong);
  border-radius: 3px;
  background: var(--ledger-surface);
}

body[data-view="auth"] .primary-button {
  min-height: 42px;
  border-radius: 3px;
  background: var(--ledger-navy);
}

body[data-view="auth"] .section-eyebrow {
  color: var(--ledger-muted);
  font: var(--ledger-font-micro) var(--ledger-mono);
  letter-spacing: 0.09em;
}

body[data-view="account"] > .topbar { display: none; }
body[data-view="account"] > main { width: auto; max-width: none; padding: 24px clamp(18px, 2.8vw, 42px); }
body[data-view="account"] .account-panel {
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid var(--ledger-border);
  border-top: 2px solid var(--ledger-navy);
  border-radius: 0;
  background: var(--ledger-surface);
  box-shadow: none;
}
body[data-view="account"] .agent-meta div { border-color: var(--ledger-border); }
body[data-view="account"] .agent-meta dt { color: var(--ledger-muted); font: var(--ledger-font-micro) var(--ledger-mono); letter-spacing: 0.07em; text-transform: uppercase; }

body[data-view="large-upload"] {
  display: block !important;
  place-items: initial !important;
  background: var(--ledger-bg) !important;
}

body[data-view="large-upload"] .upload-wrap {
  width: min(760px, calc(100vw - 32px)) !important;
  margin: 30px auto !important;
  border: 1px solid var(--ledger-border) !important;
  border-top: 3px solid var(--ledger-navy) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body[data-view="large-upload"] .upload-form input[type="file"],
body[data-view="large-upload"] .upload-form button,
body[data-view="large-upload"] .notice {
  border-radius: 3px !important;
}

body[data-view="large-upload"] .upload-form button { background: var(--ledger-navy) !important; }

/* AI conversation retains its workflow while adopting the ledger shell. */
body[data-view="agent-chat"] {
  --ledger-header-height: 64px;
  background: var(--ledger-bg);
  font-size: var(--ledger-font-body);
}

body[data-view="agent-chat"] .chat-global-sidebar { display: none !important; }
body[data-view="agent-chat"] .chat-app-shell {
  min-height: 0;
  height: calc(100svh - var(--ledger-header-height));
  grid-template-columns: 282px minmax(440px, 1fr) 284px;
}
body[data-view="agent-chat"] .chat-conversation-sidebar,
body[data-view="agent-chat"] .chat-context-panel { background: var(--ledger-surface); border-color: var(--ledger-border); }
body[data-view="agent-chat"] .chat-header { border-color: var(--ledger-border); background: var(--ledger-surface); }
body[data-view="agent-chat"] .chat-thread { background: var(--ledger-bg); }
body[data-view="agent-chat"] button,
body[data-view="agent-chat"] input,
body[data-view="agent-chat"] textarea,
body[data-view="agent-chat"] .chat-composer,
body[data-view="agent-chat"] .notification-panel,
body[data-view="agent-chat"] .chat-message { border-radius: 3px !important; }
body[data-view="agent-chat"] button,
body[data-view="agent-chat"] input,
body[data-view="agent-chat"] textarea { font-size: 13px; }
body[data-view="agent-chat"] .chat-app-shell small,
body[data-view="agent-chat"] .chat-app-shell time,
body[data-view="agent-chat"] .composer-state,
body[data-view="agent-chat"] .composer-disclaimer,
body[data-view="agent-chat"] .privacy-note { font-size: var(--ledger-font-micro); }
body[data-view="agent-chat"] .new-conversation-button,
body[data-view="agent-chat"] .composer-send,
body[data-view="agent-chat"] .wechat-bind-button {
  border-color: var(--ledger-navy) !important;
  background: var(--ledger-navy) !important;
  color: #ffffff !important;
}

body[data-view="agent-chat"] .new-conversation-button svg,
body[data-view="agent-chat"] .composer-send svg { color: currentColor !important; stroke: currentColor !important; }

/* Commercial operations retains its two-pane data workspace. */
body[data-view="commercial-control"] {
  --ledger-header-height: 64px;
  min-width: 0 !important;
  background: var(--ledger-bg) !important;
  font-size: var(--ledger-font-body);
}
body[data-view="commercial-control"] .cc-global-nav,
body[data-view="commercial-control"] .cc-mobile-menu,
body[data-view="commercial-control"] .cc-nav-backdrop { display: none !important; }
body[data-view="commercial-control"] .cc-app-shell {
  width: 100% !important;
  min-width: 0 !important;
  height: calc(100svh - var(--ledger-header-height)) !important;
  margin-left: 0 !important;
}
body[data-view="commercial-control"] .cc-customer-rail,
body[data-view="commercial-control"] .cc-workspace,
body[data-view="commercial-control"] .cc-company-context { border-color: var(--ledger-border) !important; }
body[data-view="commercial-control"] .cc-customer-rail { background: var(--ledger-surface) !important; }
body[data-view="commercial-control"] .cc-workspace { background: var(--ledger-bg) !important; }
body[data-view="commercial-control"] button,
body[data-view="commercial-control"] input,
body[data-view="commercial-control"] select,
body[data-view="commercial-control"] textarea,
body[data-view="commercial-control"] .cc-support-mode,
body[data-view="commercial-control"] .cc-company-context,
body[data-view="commercial-control"] .cc-tab-panel,
body[data-view="commercial-control"] .cc-product-card,
body[data-view="commercial-control"] .cc-agent-card,
body[data-view="commercial-control"] .cc-operations-card { border-radius: 3px !important; box-shadow: none !important; }
body[data-view="commercial-control"] button,
body[data-view="commercial-control"] input,
body[data-view="commercial-control"] select,
body[data-view="commercial-control"] textarea { font-size: 13px; }
body[data-view="commercial-control"] .cc-app-shell small { font-size: var(--ledger-font-micro); }
body[data-view="commercial-control"] .ledger-site-nav a { color: rgba(255, 255, 255, 0.74); }
body[data-view="commercial-control"] .ledger-site-nav a:hover,
body[data-view="commercial-control"] .ledger-site-nav a.is-active { color: #ffffff; }
body[data-view="commercial-control"] .cc-tabs button.is-active,
body[data-view="commercial-control"] .cc-button.is-primary,
body[data-view="commercial-control"] .cc-button.is-support { background: var(--ledger-navy) !important; }

@media (max-width: 1260px) {
  body[data-view="agent-chat"] .chat-app-shell { grid-template-columns: 264px minmax(420px, 1fr); }
}

@media (max-width: 980px) {
  .ledger-site-header { grid-template-columns: 210px minmax(0, 1fr) auto; }
  .ledger-site-nav a { padding-inline: 12px; }
  .portal-ledger-grid { grid-template-columns: minmax(0, 1fr) 250px; }
  .portal-ledger-table .col-time,
  .portal-ledger-table th:nth-child(5),
  .portal-ledger-table td:nth-child(5) { display: none; }
}

@media (max-width: 900px) {
  body[data-view="agent-chat"] { --ledger-header-height: 110px; }
  body[data-view="agent-chat"] .chat-app-shell { display: block; height: calc(100dvh - var(--ledger-header-height)); }
  body[data-view="agent-chat"] .chat-main { height: calc(100dvh - var(--ledger-header-height)); }
  body[data-view="agent-chat"] #open-navigation { display: none !important; }
}

@media (max-width: 760px) {
  :root { --ledger-header-height: 110px; }
  .ledger-site-header { grid-template-columns: minmax(0, 1fr) auto; }
  .ledger-site-brand { min-height: 58px; border-right: 0; }
  .ledger-site-account { min-height: 58px; }
  .ledger-site-account > a:first-child { display: none; }
  .ledger-site-context { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ledger-site-nav { grid-column: 1 / -1; grid-row: 2; min-height: 52px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
  .ledger-site-nav a { min-height: 52px; flex: 1 0 auto; justify-content: center; }

  .ledger-page { padding: 18px 14px 24px; }
  .ledger-title-row { align-items: flex-start; }
  .ledger-title-row h1 { font-size: 30px; }
  .ledger-title-actions .ledger-button:not(.is-dark) span { display: none; }
  .ledger-toolbar { align-items: flex-start; flex-direction: column; }
  .ledger-filters,
  .ledger-field,
  .ledger-field input,
  .ledger-field select { width: 100%; }

  .notification-ledger-summary { align-items: flex-start; flex-direction: column; }
  .notification-ledger-item { grid-template-columns: 1fr; gap: 10px; padding: 16px; }
  .notification-ledger-action { width: 100%; }

  .portal-ledger-grid { display: block; border: 0; background: transparent; }
  .portal-ledger-table-wrap { border: 1px solid var(--ledger-border); }
  .portal-ledger-table,
  .portal-ledger-table tbody,
  .portal-ledger-table tr,
  .portal-ledger-table td { display: block; width: 100%; }
  .portal-ledger-table thead,
  .portal-ledger-table caption,
  .portal-group-row { display: none; }
  .portal-record-row {
    position: relative;
    display: grid !important;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    padding: 10px 12px;
    border-bottom: 1px solid var(--ledger-border);
  }
  .portal-record-row td { display: block; padding: 5px 4px; border: 0; }
  .portal-record-row td:nth-child(1) { grid-row: 1 / 3; }
  .portal-record-row td:nth-child(2) { grid-column: 2; }
  .portal-record-row td:nth-child(3) { grid-column: 2 / 4; color: var(--ledger-muted); }
  .portal-record-row td:nth-child(4) { grid-column: 2; }
  .portal-record-row td:nth-child(5) { display: none; }
  .portal-record-row td:nth-child(6) { position: absolute; top: 12px; right: 10px; width: auto; }
  .portal-record-drawer { margin-top: 14px; border: 1px solid var(--ledger-border); }

  .ledger-admin-subnav { padding-inline: 14px; }
  body[data-view="admin-console"] .admin-page-header { align-items: flex-start; margin-inline: 14px; }
  body[data-view="admin-console"] .admin-main { padding: 14px; }
  body[data-view="admin-console"] .admin-page-actions { max-width: 42%; }

  body[data-view="commercial-control"] { --ledger-header-height: 110px; }
  body[data-view="commercial-control"] .cc-app-shell { display: block !important; width: 100% !important; height: auto !important; min-width: 0 !important; }
  body[data-view="commercial-control"] .cc-customer-rail { width: 100% !important; height: auto !important; padding-top: 0 !important; }
  body[data-view="commercial-control"] .cc-workspace { width: 100% !important; height: auto !important; }
}

@media (max-width: 520px) {
  .ledger-site-brand { padding-inline: 12px; }
  .ledger-site-brand span { display: none; }
  .ledger-site-brand strong { font-size: 16px; }
  .ledger-site-account { padding-inline: 10px; }
  .ledger-site-nav a { padding-inline: 12px; font-size: 13px; }
  .ledger-title-row { gap: 12px; }
  .ledger-title-row h1 { font-size: 27px; }
  .ledger-title-actions .ledger-button.is-dark { padding-inline: 10px; }
  body[data-view="auth"] .auth-panel,
  body[data-view="forbidden"] .auth-panel { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .ledger-button.is-loading svg { animation: none; }
}
