/* Shared workspace palette. SOP document cover/editor/reader are intentionally out of scope. */
:root {
  --ui-canvas: #f7f7f7;
  --ui-surface: #ffffff;
  --ui-chrome: #ffffff;
  --ui-field: #fafafa;
  --ui-ink: #242424;
  --ui-muted: #636363;
  --ui-line: #e5e5e5;
  --ui-accent: #216b57;
  --ui-active: #f0f2f1;
  --ui-hover: #f5f5f5;
}
/* Composite fields own the focus indicator; their input must not paint a second box. */
body.workspace-refresh #workspace .ledger-search,
body.workspace-refresh.workspace-business .search {
  background: var(--ui-field); border-color: var(--ui-line);
}
body.workspace-refresh #workspace .ledger-search:focus-within,
body.workspace-refresh.workspace-business .search:focus-within {
  border-color: var(--ui-accent); box-shadow: 0 0 0 3px #216b571a;
}
body.workspace-refresh #workspace .ledger-search input:not([type=checkbox]):not([type=radio]),
body.workspace-refresh.workspace-business .search input:not([type=checkbox]):not([type=radio]),
body.workspace-refresh #login-overlay .login-field-shell input {
  min-width: 0; background: transparent; border: 0; outline: none; box-shadow: none;
}
body.workspace-refresh #workspace .ledger-search button { background: var(--ui-surface); color: var(--ui-ink); }
/* Standalone searches retain their own rounded, keyboard-visible focus. */
body.workspace-refresh .session-search input:focus,
body.workspace-refresh.workspace-business .search-wrap input:focus,
body.workspace-refresh.live-sample-page .search-wrap input:focus,
body .sop-center-shell .sop-search-field input:focus {
  border-color: var(--ui-accent); outline: 2px solid var(--ui-accent); outline-offset: 2px;
  box-shadow: none;
}
body.workspace-refresh:is(.workspace-business, .live-sample-page), body .sop-center-shell {
  --work-bg: var(--ui-canvas);
  --work-paper: var(--ui-surface);
  --work-sidebar: var(--ui-chrome);
  --work-ink: var(--ui-ink);
  --work-muted: var(--ui-muted);
  --work-line: var(--ui-line);
  --sample-page: var(--ui-canvas);
  --sample-surface: var(--ui-surface);
  --sample-line: var(--ui-line);
  --sample-ink: var(--ui-ink);
  --sample-muted: var(--ui-muted);
  --paper: var(--ui-canvas);
  --canvas: var(--ui-canvas);
  --surface: var(--ui-surface);
  --surface-soft: var(--ui-field);
  --ink: var(--ui-ink);
  --muted: var(--ui-muted);
  --line: var(--ui-line);
  --module-menu-surface: var(--ui-surface);
  --module-menu-line: var(--ui-line);
  background: var(--ui-canvas);
  color: var(--ui-ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}
body .workspace-global-header, body .sop-center-shell > .sop-center-topbar {
  background: var(--ui-chrome); border-bottom: 1px solid var(--ui-line); box-shadow: none;
}
body.workspace-refresh :is(.module-menu-link, .module-menu-action):hover,
body .sop-center-shell :is(.module-menu-link, .module-menu-action):hover { background: var(--ui-hover); color: var(--ui-ink); }
body.workspace-refresh .module-menu-link.is-current,
body .sop-center-shell .module-menu-link.is-current { background: var(--ui-active); color: var(--ui-accent); }
body :is(.workspace-global-brand, .sop-workspace-brand) img { mix-blend-mode: multiply; }
body .sop-center-shell .sop-workspace-brand { padding-right: 24px; border-right: 1px solid var(--ui-line); }
body .sop-center-shell .sop-center-user { border: 0; background: transparent; padding: 5px; }
body .sop-center-shell .sop-center-user > b { width: 34px; height: 34px; background: var(--ui-accent); }
body .sop-center-shell .sop-center-user strong { font-size: 14px; color: var(--ui-ink); }
body .sop-center-shell .sop-center-user small { font-size: 11px; color: var(--ui-muted); }
body.workspace-refresh:is(.workspace-business, .live-sample-page) :is(h1, h2, h3, button, input, select, textarea),
body .sop-center-shell :is(h1, h2, h3, button, input, select, textarea) { font-family: inherit; }
body.workspace-refresh:is(.workspace-business, .live-sample-page) .sidebar,
body .sop-center-shell > .sop-center-navigation {
  width: 208px; padding: 16px 12px; background: var(--ui-chrome); color: var(--ui-ink);
  border-right: 1px solid var(--ui-line); box-shadow: none;
}
body.workspace-refresh:is(.workspace-business, .live-sample-page) .sidebar nav,
body .sop-center-shell .sop-center-navigation nav { margin: 12px 0 0; padding: 0; gap: 4px; }
body.workspace-refresh:is(.workspace-business, .live-sample-page) .sidebar :is(.nav, .nav-item),
body .sop-center-shell .sop-center-navigation nav a {
  display: flex; align-items: center; min-height: 42px; padding: 10px 14px;
  color: var(--ui-muted); font-size: 13px; font-weight: 500; border-radius: 6px; box-shadow: none;
}
body.workspace-refresh:is(.workspace-business, .live-sample-page) .sidebar :is(.nav, .nav-item):hover,
body .sop-center-shell .sop-center-navigation nav a:hover {
  background: var(--ui-hover); color: var(--ui-ink); box-shadow: none;
}
body.workspace-refresh:is(.workspace-business, .live-sample-page) .sidebar :is(.nav, .nav-item).is-active,
body .sop-center-shell .sop-center-navigation nav a.is-active {
  background: var(--ui-active); color: var(--ui-accent); box-shadow: inset 2px 0 var(--ui-accent); font-weight: 600;
}
body.workspace-refresh:is(.workspace-business, .live-sample-page) .sidebar :is(.nav, .nav-item) > span { color: inherit; }
body.workspace-refresh:is(.workspace-business, .live-sample-page) .sidebar :is(.nav-label, .nav-group-title),
body .sop-center-shell .sop-nav-label {
  color: var(--ui-muted); font-family: inherit; font-size: 11px; font-weight: 500; line-height: 1.5; letter-spacing: .04em;
  margin: 16px 0 4px; padding: 0 14px;
}
body.workspace-refresh:is(.workspace-business, .live-sample-page) .sidebar :is(.sidebar-note, .source-seal, .source-seal strong, .source-seal small) { color: var(--ui-muted); border-color: var(--ui-line); }
body.workspace-refresh .sidebar > .workspace-back, body .sop-center-shell .workspace-back {
  display: flex; flex-shrink: 0; align-items: center; gap: 10px; height: 42px; min-height: 42px;
  margin: 0; padding: 10px 14px; border: 0; border-radius: 6px; color: var(--ui-ink);
  font: 500 13px/1.5 "Microsoft YaHei", "PingFang SC", sans-serif; text-decoration: none;
}
body.workspace-refresh .sidebar > .workspace-back:hover, body .sop-center-shell .workspace-back:hover { background: var(--ui-hover); }
.workspace-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
body.workspace-refresh .sidebar > .workspace-back:focus-visible, body .sop-center-shell .workspace-back:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
body.workspace-refresh:is(.workspace-business, .live-sample-page) .main { margin-left: 208px; }
body .sop-center-shell { grid-template-columns: 208px minmax(0, 1fr); }
body .sop-center-shell > .sop-center-main { background: var(--ui-canvas); }
/* Main surfaces: preserve semantic warning/error colors and all domain layout rules. */
body.workspace-refresh:is(.workspace-business, .live-sample-page) :is(.panel, .metric, .stat-card, .metric-card, .selection-guide, .conversation-panel, .chat-panel, .guidance-card, .guide-intro, .table-scroll) { background: var(--ui-surface); border-color: var(--ui-line); }
body.workspace-refresh.live-sample-page .live-shell #ledger { --ledger-paper: var(--ui-surface); --ledger-mist: var(--ui-field); --ledger-line: var(--ui-line); }
body.workspace-refresh.live-sample-page .live-shell :is(.ledger-toolbar, .donut-center) { background: var(--ui-surface); }
body.workspace-refresh:is(.workspace-business, .live-sample-page) :is(input:not([type=checkbox]):not([type=radio]), select, textarea) { background-color: var(--ui-field); border-color: var(--ui-line); color: var(--ui-ink); }
body .sop-center-shell :is(.sop-metric, .sop-distribution, .sop-recent-section, .sop-library-table, .sop-task-grid > article) { background: var(--ui-surface); border-color: var(--ui-line); }
body.workspace-refresh:is(.workspace-business, .live-sample-page) :is(.panel, .metric-card, .stat-card),
body .sop-center-shell :is(.sop-metric, .sop-distribution, .sop-recent-section) { box-shadow: 0 1px 2px #00000003; }
body .sop-center-shell .sop-library-table th { background: var(--ui-field); }
body .sop-center-shell :is(input, select, textarea) { background: var(--ui-field); color: var(--ui-ink); border-color: var(--ui-line); }
/* Secondary selections share the quiet neutral treatment, rather than a mint fill. */
body.workspace-refresh.workspace-business .settings-tab:hover,
body.workspace-refresh.live-sample-page .settings-nav button:hover,
body.creator-page .session-item:hover { background: var(--ui-hover); color: var(--ui-ink); }
body.workspace-refresh.workspace-business .settings-tab.is-active,
body.workspace-refresh.live-sample-page .settings-nav button.is-active,
body.creator-page .session-item.is-active {
  background: var(--ui-active); color: var(--ui-accent); border-color: var(--ui-line); box-shadow: inset 2px 0 var(--ui-accent);
}
@media (max-width: 980px) {
  body.workspace-refresh:is(.workspace-business, .live-sample-page) .main { margin-left: 0; }
}
@media (max-width: 760px) {
  body .sop-center-shell { grid-template-columns: 1fr; }
  body .sop-center-shell > .sop-center-navigation { width: 100%; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--ui-line); }
  body .sop-center-shell .sop-center-navigation nav { margin-top: 4px; }
  body .sop-center-shell .sop-center-navigation nav a { white-space: nowrap; }
}

/* Administration uses the same frame; authorization and page handlers stay unchanged. */
/* Bounded reading widths and a shared type scale across creator views and SOP center. */
body.workspace-refresh:is(.workspace-business, .live-sample-page) .main > :is(.topbar, .view) {
  width: 100%; max-width: 1440px; margin-inline: auto; box-sizing: border-box;
}
body.workspace-refresh:is(.workspace-business, .live-sample-page) .main > .topbar { padding-inline: 28px; }
body.workspace-refresh:is(.workspace-business, .live-sample-page) .main > .view { padding-inline: 28px; }
body.workspace-refresh.live-sample-page .live-shell .main > .live-filterbar {
  width: 100%; max-width: 1440px; margin: 16px auto 0; padding: 0 28px; box-sizing: border-box;
}
/* Dense sample records use all available width; dashboards keep the bounded canvas. */
body.workspace-refresh:not(.creator-page) .main:has(> :is(#ledger, #flow, #outbound, #damage):not([hidden])) > :is(.topbar, .view, .live-filterbar),
body.workspace-refresh.live-sample-page .main:has(> #activity:not([hidden])) > :is(.topbar, .view, .live-filterbar) {
  max-width: none;
}
body.workspace-refresh:is(.workspace-business, .live-sample-page) .main > .notice { max-width: 1384px; margin: 12px auto; }
@media (max-width: 760px) {
  body.workspace-refresh:is(.workspace-business, .live-sample-page) .main > :is(.topbar, .view),
  body.workspace-refresh.live-sample-page .live-shell .main > .live-filterbar { padding-inline: 16px; }
  body.workspace-refresh:is(.workspace-business, .live-sample-page) .main > .notice { margin-inline: 16px; }
}
body.creator-page, body .sop-center-shell { font-size: 14px; line-height: 1.6; }
.workspace-nav-icon { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
body .sop-center-shell .sop-center-navigation nav a { gap: 10px; }
body.creator-page .main > .topbar,
body.creator-page .main > .view,
body .sop-center-shell .sop-center-content,
body .sop-center-shell .sop-center-page-heading { width: 100%; max-width: 1440px; margin-inline: auto; box-sizing: border-box; }
body.creator-page .main > .topbar { min-height: 88px; padding: 24px 28px 12px; }
body.creator-page .main > .view { padding: 12px 28px 32px; }
body.creator-page .topbar h1,
body .sop-center-shell .sop-center-content h1 { font-size: 26px; font-weight: 600; line-height: 1.4; letter-spacing: 0; }
body.creator-page :is(.button, input, select, textarea, .message-bubble, .view-heading p),
body .sop-center-shell :is(button, input, select, textarea, td) { font-size: 14px; }
body.creator-page :is(th, td) { font-size: 14px; line-height: 1.6; padding: 14px 16px; }
body.creator-page .selection-guide { grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; padding: 16px 20px; margin-bottom: 12px; }
body.creator-page .guide-copy .section-kicker { display: none; }
body.creator-page .guide-copy h2 { margin: 0 0 4px; font-size: 16px; line-height: 1.5; }
body.creator-page .guide-copy p { margin: 0; font-size: 13px; }
body.creator-page .selection-toolbar { grid-column: 2; grid-row: 1; }
body.creator-page .selection-steps { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-top: 12px; border-top: 1px solid var(--ui-line); }
body.creator-page .selection-steps li { padding: 0 12px; font-size: 13px; }
body.creator-page .selection-steps small { font-size: 12px; }
body.creator-page .usage-start { margin: 0 0 12px; padding: 12px 20px; gap: 16px; }
body.creator-page .usage-start strong { font-size: 14px; }
body.creator-page .usage-start p { margin: 4px 0 0; font-size: 13px; }
body.creator-page .selection-workspace { width: 100%; min-height: 0; }
body.creator-page .conversation-panel { height: max(560px, calc(100dvh - 390px)); min-height: 560px; }
body.creator-page .conversation-heading { padding: 16px 20px; }
body.creator-page #conversation-title { font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
body.creator-page .message-list { padding: 20px 24px; background: var(--ui-surface); }
body.creator-page #history-view .view-heading :is(.section-kicker, h2) { display: none; }
body.creator-page #history-view .view-heading { margin-bottom: 16px; }
body.creator-page #history-view table { table-layout: fixed; width: 100%; min-width: 740px; }
body.creator-page #history-view th:first-child { width: 44%; }
body.creator-page #history-view td:first-child { overflow-wrap: anywhere; }
body.creator-page #history-view .button { min-height: 34px; padding: 6px 12px; }
body .sop-center-shell .sop-center-content { padding: 16px 28px 40px; }
body .sop-center-shell .sop-center-page-heading { padding: 24px 28px 0; font-size: 13px; }
body .sop-center-shell .sop-metric { padding: 18px 20px; }
body .sop-center-shell .sop-metric span { font-size: 14px; font-weight: 500; }
body .sop-center-shell .sop-metric strong { font-size: 28px; line-height: 1.4; }
body .sop-center-shell .sop-metric small { font-size: 12px; color: var(--ui-muted); }
body .sop-center-shell :is(.sop-distribution, .sop-recent-section) h2 { font-size: 16px; }
@media (max-width: 760px) {
  body.creator-page .main > .topbar { padding: 20px 16px 8px; min-height: 72px; }
  body.creator-page .main > .view, body .sop-center-shell .sop-center-content { padding: 12px 16px 28px; }
  body.creator-page .selection-guide { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  body.creator-page .selection-toolbar { grid-column: 1; grid-row: 2; flex-wrap: wrap; }
  body.creator-page .selection-steps { grid-row: 3; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.creator-page .usage-start { padding: 14px; }
  body.creator-page .message-list { padding: 16px; }
  body.creator-page #history-view th:first-child { width: 34%; }
  body .sop-center-shell .sop-center-page-heading { padding: 16px 16px 0; }
}
body.workspace-refresh #workspace {
  --platform-paper: var(--ui-canvas); --platform-surface: var(--ui-surface);
  --platform-ink: var(--ui-ink); --platform-text: var(--ui-ink);
  --platform-muted: var(--ui-muted); --platform-line: var(--ui-line);
  --module-menu-surface: var(--ui-surface);
  display: grid; grid-template-columns: 208px minmax(0, 1fr); grid-template-rows: 64px minmax(calc(100vh - 64px), auto);
  background: var(--ui-canvas); font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}
body.workspace-refresh #workspace .workspace-topbar {
  grid-column: 1 / -1; grid-row: 1; height: 64px; min-height: 64px; padding: 0 24px; gap: 24px;
  justify-content: flex-start; background: var(--ui-chrome); box-shadow: none; backdrop-filter: none;
}
body.workspace-refresh #workspace .workspace-topbar > div:first-of-type { border-left: 1px solid var(--ui-line); padding-left: 24px; }
body.workspace-refresh #workspace .workspace-topbar h1 { font: 600 15px/1.5 "Microsoft YaHei", sans-serif; margin: 0; letter-spacing: 0; }
body.workspace-refresh #workspace .workspace-header-actions { margin-left: auto; }
body.workspace-refresh #workspace .workspace-account-summary { border: 0; background: transparent; padding: 5px; }
body.workspace-refresh #workspace .user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ui-accent); }
body.workspace-refresh #workspace .workspace-rail {
  grid-column: 1; grid-row: 2; top: 64px; height: calc(100vh - 64px); padding: 16px 12px;
  background: var(--ui-chrome); border-right: 1px solid var(--ui-line);
}
body.workspace-refresh #workspace .workspace-main { grid-column: 2; grid-row: 2; background: var(--ui-canvas); }
body.workspace-refresh #workspace .workspace-back {
  display: flex; align-items: center; gap: 10px; min-height: 42px; height: 42px; padding: 10px 14px;
  color: var(--ui-ink); border-radius: 6px; font-size: 13px; font-weight: 500; text-decoration: none;
}
body.workspace-refresh #workspace .workspace-rail nav { margin: 12px 0 0; gap: 4px; }
body.workspace-refresh #workspace .rail-link { min-height: 42px; padding: 10px 14px; color: var(--ui-muted); font-size: 13px; border-radius: 6px; }
body.workspace-refresh #workspace :is(.rail-link:hover, .workspace-back:hover) { background: var(--ui-hover); color: var(--ui-ink); box-shadow: none; }
body.workspace-refresh #workspace .rail-link.is-active { background: var(--ui-active); color: var(--ui-accent); box-shadow: inset 2px 0 var(--ui-accent); font-weight: 600; }
body.workspace-refresh #workspace .rail-dot { background: currentColor; box-shadow: none; }
body.workspace-refresh #workspace .rail-foot { color: var(--ui-muted); }
body.workspace-refresh #workspace .workspace-content { width: 100%; max-width: 1504px; padding: 28px 32px 48px; }
body.workspace-refresh #workspace :is(h1, h2, h3, .section-title, button, input, select, textarea, th) { font-family: inherit; }
body.workspace-refresh #workspace :is(.accounts-masthead, .content-heading) h2,
body.workspace-refresh #workspace .section-title { font-size: 26px; line-height: 1.4; font-weight: 600; letter-spacing: 0; }
body.workspace-refresh #workspace :is(input:not([type=checkbox]):not([type=radio]), select, textarea) { background: var(--ui-field); color: var(--ui-ink); }
body.workspace-refresh #workspace .primary-action { background: var(--ui-accent); border-color: var(--ui-accent); }
body.workspace-refresh #workspace :is(.organization-directory-bar, .organization-page .ledger-panel, .audit-filter-panel) {
  background: var(--ui-surface); box-shadow: 0 1px 2px #00000003;
}
@media (max-width: 1020px) {
  body.workspace-refresh #workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  body.workspace-refresh #workspace .workspace-topbar { grid-row: 1; flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 12px; }
  body.workspace-refresh #workspace .workspace-rail { grid-row: 2; grid-column: 1; position: static; height: auto; min-width: 0; flex-direction: column; align-items: stretch; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--ui-line); }
  body.workspace-refresh #workspace .workspace-rail nav { display: flex; min-width: 0; overflow-x: auto; margin-top: 4px; }
  body.workspace-refresh #workspace .rail-link { flex: 0 0 auto; white-space: nowrap; }
  body.workspace-refresh #workspace .workspace-main { grid-row: 3; grid-column: 1; }
  body.workspace-refresh #workspace .workspace-content { padding: 24px 16px; }
}
