/* Shared product layer. Load after page styles; structural page IDs remain stable. */
:root {
  --app-bg:#f4f6f9; --app-surface:#fff; --app-surface-solid:#fff;
  --app-elevated:#f0f3f8; --app-surface-soft:#f0f3f8; --app-surface-2:#f0f3f8;
  --app-text:#17263b; --app-muted:#596a80; --app-border:#dce3ec;
  --app-primary:#315bcc; --app-primary-2:#2446a8; --app-primary-soft:#eaf0ff;
  --app-sidebar:#fff; --app-sidebar-text:#4b5e77;
  --app-success:#13764f; --app-danger:#bd3048; --app-warning:#8a5b09;
  --app-shadow:0 8px 28px #17263b0a; --app-shadow-sm:0 2px 8px #17263b06;
  --ux-surface:var(--app-surface); --ux-ink:var(--app-text); --ux-line:var(--app-border);
  --ux-soft:var(--app-elevated); --ux-accent:var(--app-primary); --app-radius:14px;
}
:root[data-theme="dark"] {
  color-scheme:dark; --app-bg:#0e1522; --app-surface:#172131; --app-surface-solid:#172131;
  --app-elevated:#1f2d41; --app-surface-soft:#1f2d41; --app-surface-2:#1f2d41;
  --app-text:#e8edf6; --app-muted:#adbbce; --app-border:#344256;
  --app-primary:#9ab6ff; --app-primary-2:#bdd0ff; --app-primary-soft:#253753;
  --app-sidebar:#121c2c; --app-sidebar-text:#bdcadb;
  --app-success:#78d6ab; --app-danger:#ff94a5; --app-warning:#f2cc83;
  --app-shadow:0 8px 28px #0002; --app-shadow-sm:0 2px 8px #0001;
  --ux-surface:var(--app-surface); --ux-ink:var(--app-text); --ux-line:var(--app-border);
  --ux-soft:var(--app-elevated); --ux-accent:var(--app-primary);
}
:root[data-theme="light"] { color-scheme:light; }
:root,:root[data-theme="dark"],:root[data-theme="light"] {
  --ink:var(--app-bg); --surface:var(--app-surface-solid); --surface-2:var(--app-elevated);
  --fg:var(--app-text); --fg-2:var(--app-muted); --fg-3:var(--app-muted); --rule:var(--app-border);
}
html { font-size:16px; }
body.app-page, body.auth-page { color:var(--app-text); background:var(--app-bg)!important; line-height:1.8; }
.app-page :is(.card,.command-card,.agent-panel,.modal-content,.dropdown-menu,.profile-tabs-shell) {
  color:var(--app-text); background:var(--app-surface); border-color:var(--app-border); box-shadow:var(--app-shadow-sm);
}
.app-page :is(.bg-white,.card-header,.modal-header,.modal-footer) { background:var(--app-surface)!important; color:var(--app-text)!important; border-color:var(--app-border)!important; }
.app-page :is(.text-dark,.text-black,.text-black-50) { color:var(--app-text)!important; }
.app-page :is(.text-muted,.text-secondary) { color:var(--app-muted)!important; }
/* width:auto, not 100%: a 100% box plus the 260px sidebar margin pushed 260px of every non-flex page
   off the left edge. flex keeps the flex-bodied pages (dashboard-page) filling the same space. */
.app-page .main-content { margin-left:0!important; margin-right:260px!important; width:auto!important; flex:1 1 0%; min-width:0; }
body.app-page.sidebar-collapsed .main-content { margin:0!important; width:auto!important; }
.app-page .main-content > .container-fluid { padding:clamp(16px,2.2vw,32px)!important; }
.app-page .app-topbar { min-height:72px; background:var(--app-surface)!important; border-bottom:1px solid var(--app-border); box-shadow:none; }
.app-page .app-topbar > .container-fluid { gap:12px; padding-inline:clamp(16px,2.2vw,32px); }
.app-route-title { min-width:0; }
.app-page .app-route-title > span { font-size:1rem; font-weight:700; }
.app-page .app-route-title small { font-size:.8125rem; color:var(--app-muted); }
.app-page .sidebar { background:var(--app-sidebar)!important; border-inline-end:1px solid var(--app-border); box-shadow:none; overflow-y:auto; }
.app-page .sidebar :is(.app-brand strong,.app-user-card strong) { color:var(--app-text); }
.app-page .sidebar :is(.app-brand small,.app-user-card small) { color:var(--app-muted); }
.app-page .app-user-card { background:var(--app-elevated); border-color:var(--app-border); }
.app-page .sidebar .nav-link { color:var(--app-sidebar-text)!important; min-height:46px; border-radius:9px; font-size:.9375rem; padding:10px 14px; margin-block:4px; }
.app-page .sidebar .nav-link.active { background:var(--app-primary-soft)!important; color:var(--app-primary)!important; box-shadow:none; font-weight:700; }
.app-page .sidebar .nav-link:hover { background:var(--app-elevated); }
.app-brand-mark { background:#315bcc!important; color:#fff!important; border-radius:12px; }
.app-avatar { background:var(--app-primary-soft); color:var(--app-primary); }
.app-page .app-icon-button { min-width:42px; min-height:42px; color:var(--app-text); border:1px solid var(--app-border); border-radius:10px; }
.app-page h1 { font-size:clamp(1.35rem,2.1vw,2rem)!important; line-height:1.55; letter-spacing:normal; }
.app-page h2 { font-size:1.125rem!important; line-height:1.7; }
.app-page :is(p,label,.form-label,.agent-table,.agent-tabs button,.ux-tabs button,.profile-tabs button,.workspace-tabs button) { font-size:.875rem!important; }
.app-page :is(small,.page-eyebrow,.command-card-header p,.agent-panel header small,.agent-event-list p,.agent-task-main p) { font-size:.8125rem!important; line-height:1.8; }
.app-page :is(.agent-task-main strong,.agent-plan-head strong,.agent-route-list strong,.agent-enterprise-card header strong,.agent-settings-section header strong) { font-size:.9375rem!important; line-height:1.7; }
.app-page :is(.btn,.form-control,.form-select,.dropdown-item) { font-size:.875rem; }
.app-page :is(.form-control,.form-select) { min-height:44px; color:var(--app-text); background-color:var(--app-surface); border-color:var(--app-border); border-radius:9px; }
.app-page :is(.form-control,.form-select):focus { background:var(--app-surface); color:var(--app-text); border-color:var(--app-primary); box-shadow:0 0 0 3px color-mix(in srgb,var(--app-primary) 18%,transparent); }
.app-page input::placeholder,.app-page textarea::placeholder { color:var(--app-muted); opacity:.85; }
.app-page textarea.form-control { line-height:1.9; resize:vertical; }
.app-page .btn { min-height:40px; padding:8px 14px; border-radius:9px; }
.app-page .btn-primary,.auth-page .auth-submit { background:#315bcc!important; color:#fff!important; border-color:#315bcc!important; box-shadow:none; }
.app-page .btn-outline-primary { color:var(--app-primary); border-color:var(--app-primary); }
.app-page .btn-outline-primary:hover { color:var(--app-primary); background:var(--app-primary-soft); }
.app-page :is(.nav-pills,.profile-tabs,.agent-tabs,.workspace-tabs,.ux-tabs) { gap:6px; overflow-x:auto; overscroll-behavior-inline:contain; flex-wrap:nowrap; scrollbar-width:thin; max-width:100%; }
.app-page :is(.nav-pills,.profile-tabs,.agent-tabs,.workspace-tabs,.ux-tabs) button { white-space:nowrap; flex-shrink:0; min-height:44px; }
.app-page .nav-pills .nav-link.active { background:var(--app-primary-soft); color:var(--app-primary); }
.agent-platform-page .agent-tabs { top:72px; backdrop-filter:none; background:var(--app-surface); }
.app-page :is(.agent-form-row,.agent-platform-grid,.agent-layout,.command-grid,.profile-tab-panels) { min-width:0; }
.app-page .agent-ide { grid-template-columns:minmax(180px,.65fr) minmax(320px,1.7fr) minmax(240px,.9fr); }
.app-page .agent-page-main { height:calc(100dvh - 72px); min-height:min(560px,calc(100dvh - 72px)); }
.app-page .agent-session-identity h1 { font-size:1.05rem!important; }
.agent-inspector-tabs { overflow-x:auto; flex-wrap:nowrap; min-width:0; scrollbar-width:thin; }
.agent-inspector-tabs button { white-space:nowrap; flex-shrink:0; min-height:44px; }
.app-page :is(.table-responsive,.agent-table-scroll) { max-width:100%; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; }
.app-page :is(table.table,table.agent-table) { --bs-table-bg:var(--app-surface); --bs-table-color:var(--app-text); --bs-table-border-color:var(--app-border); color:var(--app-text); font-size:.875rem; }
.app-page :is(table.table,table.agent-table) th { background:var(--app-elevated); color:var(--app-muted); font-size:.8125rem; padding:12px; white-space:nowrap; }
.app-page :is(table.table,table.agent-table) td { padding:12px; vertical-align:middle; }
.app-page .profile-optional-field { display:block; }
.app-page [role="tabpanel"][hidden] { display:none!important; }
.profile-security-card { grid-template-columns:48px minmax(0,1fr) auto; }
.app-page .command-kpis { gap:14px; }
.decision-kpi { background:var(--app-surface)!important; box-shadow:none!important; border:1px solid var(--app-border); border-radius:14px; min-height:126px; }
.decision-kpi:hover { border-color:var(--app-primary); }
.decision-kpi strong { font-size:clamp(1.25rem,2vw,1.8rem)!important; font-variant-numeric:tabular-nums; }
.decision-kpi small { color:var(--app-muted); }
.command-card { border-radius:14px; }
.dashboard-chart-control { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:12px 0; }
.dashboard-chart-control select { width:auto; max-width:65%; }
.dashboard-chart-details { border-top:1px solid var(--app-border); padding:12px 0; color:var(--app-muted); }
.dashboard-chart-details summary { cursor:pointer; font-size:.8125rem; }
.dashboard-chart-details .table-responsive { max-height:320px; margin-top:12px; }
.financial-tabs { margin-top:24px; }
.app-page :is(.command-header,.command-card-header,.agent-page-header) { gap:16px; flex-wrap:wrap; }
.app-page :is(.agent-chat-message,.ai-rich-response,.ct-chat-message,.workspace-chat-message) { overflow-wrap:anywhere; line-height:1.95; }
.app-page :is(pre,.ai-table-wrap) { max-width:100%; overflow:auto; }
.app-page :is(.modal:not(.ct-modal) .modal-content) { max-height:calc(100dvh - 40px); }
.app-page .modal:not(.ct-modal) .modal-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.auth-page .auth-shell { min-height:100dvh; }
.auth-page .auth-form-panel { background:var(--app-surface); color:var(--app-text); }
.auth-page .auth-form-wrap { width:min(100%,440px); padding-block:32px; }
.auth-page .auth-input { background:var(--app-bg); border-color:var(--app-border); }
.auth-page .auth-input input { color:var(--app-text); background:transparent; min-height:48px; font-size:1rem; }
.auth-page .auth-form-wrap p { color:var(--app-muted); line-height:1.9; }
.auth-page .auth-brand-panel { background:#172a48!important; }
.auth-page .auth-brand-copy em { color:#b7ceff; }
.auth-page .auth-secondary-action { color:var(--app-primary); border-color:var(--app-border); }
.ux-notice[data-tone="warning"] { border-inline-start-color:var(--app-warning); }
.ux-notice[data-tone="danger"],.ux-notice[data-tone="error"] { border-inline-start-color:var(--app-danger); }
.app-skip-link { position:fixed; top:8px; inset-inline-start:16px; z-index:2000; padding:10px 18px; color:#fff; background:#2446a8; border-radius:8px; transform:translateY(-160%); }
.app-skip-link:focus { transform:none; }
#appSidebarBackdrop { display:none; }
body :is(button,a,input,textarea,select,[tabindex]):focus-visible { outline:3px solid var(--app-primary,#315bcc); outline-offset:3px; }
@media(max-width:1199.98px) {
  .app-page .agent-ide { grid-template-columns:220px minmax(0,1fr); }
  .agent-inspector { top:72px; }
  .agent-inspector [data-agent-close="inspector"], [data-agent-open="inspector"] { display:inline-flex!important; }
}
@media(max-width:991.98px) {
  body.app-page .main-content { width:100%!important; margin:0!important; }
  body.app-page .sidebar { z-index:1045; width:min(320px,calc(100vw - 48px))!important; max-width:none; visibility:hidden; transform:translateX(105%)!important; }
  body.app-page .sidebar.show { visibility:visible; transform:none!important; }
  body.sidebar-open { overflow:hidden; }
  body.app-page.sidebar-open::before { display:none!important; }
  #appSidebarBackdrop:not([hidden]) { display:block; position:fixed; inset:0; z-index:1044; background:#08142780; border:0; }
  .app-page .agent-tabs { top:72px; }
  .app-page .agent-ide { grid-template-columns:minmax(0,1fr); }
  .agent-session-panel { top:72px; }
  .app-page .agent-global-state #newAgentSessionBtn,.app-page .agent-global-state #agentSettingsBtn { font-size:.8125rem; width:auto; padding:8px 12px; }
}
@media(max-width:767.98px) {
  .app-page .main-content > .container-fluid { padding:16px!important; }
  .app-route-title small { display:none; }
  .app-profile-pill > span:not(.app-avatar) { display:none; }
  .app-page :is(.agent-form-row,.agent-platform-grid,.command-grid,.work-metrics) { grid-template-columns:minmax(0,1fr)!important; }
  .app-page .command-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .decision-kpi { min-height:120px; padding:14px!important; }
  .decision-kpi-icon { display:none!important; }
  .app-page .btn { min-height:44px; }
  .profile-security-card { grid-template-columns:40px minmax(0,1fr); }
  .profile-security-card > button { grid-column:1/-1; }
  .app-page .modal:not(.ct-modal) .modal-dialog { margin:8px; }
  .app-page .modal:not(.ct-modal) .modal-content { max-height:calc(100dvh - 16px); }
  .auth-page .auth-form-wrap { padding-inline:20px; }
  .ux-notices { bottom:calc(12px + env(safe-area-inset-bottom)); inset-inline:12px; width:auto; }
}
.ks-import{display:grid;gap:.4rem;margin:1rem 0;padding:1rem;border:1px solid var(--app-border);border-radius:14px;background:var(--app-surface-soft)}
.ks-import label{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.75rem;font-weight:700}
.ks-import input[type=file]{max-width:100%;font-weight:400}
.ks-import small{color:var(--app-muted);line-height:1.8}
@media(max-width:379.98px) { .app-page .command-kpis { grid-template-columns:minmax(0,1fr); } }
@media(prefers-reduced-motion:reduce) { .sidebar,.main-content,.app-skip-link { transition:none!important; } }

/* ════════════════════════════════════════════════════════════════════════════
   UX pass, Mehr 1405: one plain layer for everyone, a technical layer one click deeper.
   ════════════════════════════════════════════════════════════════════════════ */

/* Pro view toggle in the top bar. */
.app-page .app-pro-toggle { display:inline-flex; align-items:center; gap:8px; padding-inline:12px; font-size:.875rem; font-weight:600; background:transparent; }
.app-page .app-pro-toggle[aria-pressed="true"] { background:var(--app-primary-soft); color:var(--app-primary); border-color:var(--app-primary); }
@media(max-width:767.98px) { .app-page .app-pro-toggle span { display:none; } .app-page .app-pro-toggle { padding-inline:0; justify-content:center; } }

/* The technical layer. Closed for most people; pro view opens it everywhere. */
body:not(.pro-view) .pro-only { display:none!important; }
details.pro-details { border:1px dashed var(--app-border); border-radius:10px; background:var(--app-surface); margin-top:10px; }
details.pro-details > summary { display:flex; align-items:center; gap:8px; min-height:44px; padding:8px 14px; cursor:pointer; color:var(--app-muted); font-size:.875rem; font-weight:600; list-style:none; }
details.pro-details > summary::-webkit-details-marker { display:none; }
details.pro-details > summary::before { content:"\f13a"; font:var(--fa-font-solid, 900 1em "Font Awesome 7 Free"); font-weight:900; font-size:.8rem; transition:transform .2s; }
details.pro-details[open] > summary::before { transform:rotate(180deg); }
details.pro-details > summary:hover { color:var(--app-primary); }
.pro-details-body { padding:4px 14px 14px; display:grid; gap:10px; min-width:0; font-size:.875rem; color:var(--app-text); }
.pro-details-body :is(pre,code,.pro-raw) { font-family:"IBM Plex Mono",Consolas,monospace; font-size:.8125rem; direction:ltr; text-align:left; unicode-bidi:isolate; }
.pro-details-body pre, .pro-raw { margin:0; padding:10px 12px; background:var(--app-elevated); border-radius:8px; white-space:pre-wrap; overflow-wrap:anywhere; max-height:none; }
.pro-kv { display:grid; grid-template-columns:max-content minmax(0,1fr); gap:4px 14px; margin:0; }
.pro-kv dt { color:var(--app-muted); font-weight:600; }
.pro-kv dd { margin:0; overflow-wrap:anywhere; }
.ltr { direction:ltr; unicode-bidi:isolate; }

/* The four surfaces of a project, one bar on each of them. */
.project-journey { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; padding:4px; margin:0 0 18px; background:var(--app-elevated); border:1px solid var(--app-border); border-radius:12px; }
.project-journey a { display:flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:6px 10px; border-radius:9px; color:var(--app-muted); font-size:.9375rem; font-weight:600; text-decoration:none; text-align:center; line-height:1.4; }
.project-journey a:hover { color:var(--app-primary); background:var(--app-surface); }
.project-journey a.is-current { background:var(--app-surface); color:var(--app-primary); box-shadow:var(--app-shadow-sm); border:1px solid var(--app-border); }
@media(max-width:767.98px) {
  .project-journey { margin-bottom:12px; }
  .project-journey a { flex-direction:column; gap:2px; font-size:.75rem; padding:6px 4px; min-height:52px; }
  .project-journey a i { font-size:1rem; }
}
.project-agent-page .project-journey { flex:0 0 auto; margin-bottom:10px; }

/* Tabs never hide on a phone: they wrap instead of scrolling sideways with no sign there is more. */
@media(max-width:767.98px) {
  .app-page :is(.nav-pills,.profile-tabs,.agent-tabs,.workspace-tabs,.ux-tabs,.agent-inspector-tabs,.builder-tabs,.nav-tabs) { flex-wrap:wrap!important; overflow:visible!important; }
  .app-page :is(.nav-pills,.profile-tabs,.agent-tabs,.workspace-tabs,.ux-tabs,.agent-inspector-tabs,.builder-tabs,.nav-tabs) > :is(button,a,li) { flex:1 1 auto!important; white-space:normal!important; justify-content:center; text-align:center; }
  .app-page :is(.nav-pills,.nav-tabs) > li > :is(button,a) { width:100%; }
}

/* Type floor: nothing a person has to read is smaller than 12px. */
.app-page :is(small,.small,time,em) { font-size:max(.75rem,.8em); }

/* Sign-in, registration and recovery. Labels were 10.4px, the submit 11.5px, the eye toggle 34px. */
.auth-page .auth-form-wrap > header { display:grid; gap:6px; }
.auth-page .auth-form-wrap > header > small { font-size:.8125rem; }
.auth-page .auth-form-wrap header p { font-size:.9375rem; }
.auth-page :is(.enterprise-form,.auth-form-grid) > label, .auth-page .enterprise-form label { font-size:.875rem; }
.auth-page .enterprise-form label > span small { display:inline; font-size:.8125rem; color:var(--app-muted); font-weight:500; }
.auth-page .auth-submit { font-size:1rem; min-height:52px; }
.auth-page .auth-input button { width:44px; height:44px; }
.auth-page :is(.auth-form-options,.auth-divider,.auth-legal,.auth-secondary-action) { font-size:.875rem; }
.auth-page .auth-form-options > a { display:inline-flex; align-items:center; min-height:44px; }
.auth-page .auth-check { min-height:44px; font-size:.875rem; }
.auth-page .auth-check > span { width:22px; height:22px; }
.auth-page .auth-steps small, .auth-page .auth-capabilities small, .auth-page .auth-brand small { font-size:.8125rem; }
.auth-page :is(.btn,.btn-sm) { min-height:44px; font-size:.875rem; }
.auth-theme-toggle { width:44px!important; height:44px!important; }
@media(max-width:991.98px) {
  /* Fixed, it rode over the first field as soon as the form scrolled. */
  .auth-theme-toggle { position:absolute!important; }
  .auth-page .auth-mobile-brand { margin-bottom:4px; }
}

/* Dashboard: waiting-for-you, projects with their next step, account status; operations below. */
.dashboard-v3 { display:grid; gap:18px; }
.dashboard-v3 > * { margin:0!important; }
.dashboard-v3 .dashboard-link { display:inline-flex; align-items:center; gap:6px; min-height:44px; font-weight:600; font-size:.875rem; white-space:nowrap; }
.dashboard-v3 :is(.knowledge-build-list,.command-activity,.agent-run-list,.attention-list) { max-height:none!important; overflow:visible!important; }
.dashboard-v3 .dashboard-chart-details .table-responsive { max-height:none; }
.today-count { font-size:.875rem; color:var(--app-muted); white-space:nowrap; }
.today-list { display:grid; gap:10px; padding:4px 18px 18px; }
.today-item { display:grid; grid-template-columns:40px minmax(0,1fr) auto; gap:12px; align-items:start; padding:14px; border:1px solid var(--app-border); border-inline-start:4px solid var(--app-warning); border-radius:12px; background:var(--app-surface); }
.today-item[hidden] { display:none; }
.today-item.is-danger { border-inline-start-color:var(--app-danger); }
.today-item.is-blue, .today-item.is-primary { border-inline-start-color:var(--app-primary); }
.today-item.is-neutral { border-inline-start-color:var(--app-border); }
.today-icon { display:grid; place-items:center; width:40px; height:40px; border-radius:10px; background:var(--app-elevated); color:var(--app-warning); }
.today-item.is-danger .today-icon { color:var(--app-danger); }
.today-item:is(.is-blue,.is-primary) .today-icon { color:var(--app-primary); }
.today-copy { display:grid; gap:2px; min-width:0; }
.today-copy strong { font-size:.9375rem; line-height:1.7; }
.today-copy small { color:var(--app-muted); font-size:.875rem; line-height:1.8; }
.today-action { white-space:nowrap; align-self:center; }
.today-more { min-height:44px; border:1px dashed var(--app-border); border-radius:10px; background:transparent; color:var(--app-primary); font-weight:600; font-size:.875rem; }
.today-clear { display:flex; gap:12px; align-items:center; padding:14px; border-radius:12px; background:var(--app-elevated); }
.today-clear > span { display:grid; place-items:center; width:40px; height:40px; border-radius:50%; background:var(--app-surface); color:var(--app-success); }
.today-clear div { display:grid; } .today-clear small { color:var(--app-muted); font-size:.875rem; }
@media(max-width:575.98px) {
  .today-list { padding:4px 12px 14px; }
  .today-item { grid-template-columns:36px minmax(0,1fr); }
  .today-icon { width:36px; height:36px; }
  .today-action { grid-column:1/-1; justify-self:stretch; text-align:center; }
}
.project-next-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,260px),1fr)); gap:12px; padding:4px 18px 18px; }
.project-next { display:grid; gap:8px; align-content:start; padding:16px; border:1px solid var(--app-border); border-radius:12px; background:var(--app-surface); min-width:0; }
.project-next-head { display:flex; justify-content:space-between; align-items:baseline; gap:10px; }
.project-next-head h3 { margin:0; font-size:1rem; font-weight:700; line-height:1.6; min-width:0; overflow-wrap:anywhere; }
.project-next-head h3 a { color:var(--app-text); text-decoration:none; }
.project-next-head h3 a:hover { color:var(--app-primary); }
.project-next-head time { color:var(--app-muted); font-size:.8125rem; white-space:nowrap; }
.project-next-desc { margin:0; color:var(--app-muted); font-size:.875rem; line-height:1.8; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.project-next-state { display:flex; flex-wrap:wrap; gap:6px 12px; font-size:.8125rem; }
.project-next-state b { font-weight:600; display:inline-flex; align-items:center; gap:6px; }
.project-next-hint { margin:0; font-size:.875rem; color:var(--app-text); }
.project-next-actions { display:flex; gap:8px; align-items:center; margin-top:4px; }
.project-next-actions .btn { flex:1; }
.project-next-actions .app-icon-button { display:inline-grid; place-items:center; width:44px; height:44px; flex:0 0 44px; }
@media(max-width:575.98px) { .project-next-list { padding:4px 12px 14px; } }
.dashboard-ops { margin:0!important; }
.dashboard-ops > .pro-details-body { gap:18px; padding:4px 12px 16px; }
.dashboard-ops > summary { font-size:.9375rem; }
.stalled-builds { border-top:1px solid var(--app-border); }
.stalled-builds > summary { display:grid; grid-template-columns:33px minmax(0,1fr); gap:9px; align-items:center; min-height:63px; padding:10px 14px; cursor:pointer; list-style:none; }
.stalled-builds > summary::-webkit-details-marker { display:none; }
.stalled-builds > summary > span:last-child { display:grid; }
.stalled-builds > summary small { color:var(--app-muted); font-size:.8125rem; }
.pro-raw { display:block; margin-top:6px; }
.app-page .system-health { font-size:.8125rem; min-height:44px; }
.app-page .system-health.is-warning { background:color-mix(in srgb,var(--app-warning) 9%,var(--app-surface-solid)); border-color:color-mix(in srgb,var(--app-warning) 30%,var(--app-border)); }
.app-page .system-health.is-danger { background:color-mix(in srgb,var(--app-danger) 8%,var(--app-surface-solid)); border-color:color-mix(in srgb,var(--app-danger) 30%,var(--app-border)); }
:root:not([data-theme="dark"]) .app-page .system-health.is-danger { color:#a3182f; }
.dashboard-v3 .project-next-state :is(.status-dot,.knowledge-state) { font-size:.8125rem; }
.dashboard-v3 .today-count { font-size:.875rem; }
.project-next-head h3 a { display:inline-flex; align-items:center; min-height:32px; }

/* Projects list: compact cards, 44px actions, one readable date. */
.projects-page .project-card .project-actions { grid-template-columns:minmax(0,1fr) repeat(4,44px); }
.projects-page .project-card .project-actions .btn { min-height:44px; }
.projects-page .project-card .project-open-action span { font-size:.875rem; }
.projects-page .project-card .project-date { color:var(--app-muted); font-size:.8125rem; opacity:1; }
.projects-page .project-card .project-date * { color:inherit; }
.projects-page .project-card .badge { font-size:.75rem; }
.projects-page .project-search input { min-height:44px; }
.projects-page .pagination .page-link { min-width:44px; min-height:44px; display:grid; place-items:center; }
@media(max-width:575.98px) {
  .projects-page .project-path-guide { display:none; }
  .projects-page .project-card .card-header, .projects-page .project-card .card-body { padding:12px 14px; }
  .projects-page .project-card .project-description { -webkit-line-clamp:2; display:-webkit-box; -webkit-box-orient:vertical; overflow:hidden; margin-bottom:8px; }
  .projects-page #projectsGrid { --bs-gutter-y:12px; }
}

/* Build and release: back link on its own line, one status sentence with its one button. */
.commercial-page .work-back { display:inline-flex; align-items:center; gap:8px; min-height:44px; font-size:.875rem; font-weight:600; text-decoration:none; }
.work-summary { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; padding:16px 18px; margin:0 0 14px; border:1px solid var(--app-border); border-inline-start:4px solid var(--app-primary); border-radius:12px; background:var(--app-surface); }
.work-summary[hidden] { display:none; }
.work-summary p { margin:0; font-size:1rem; font-weight:600; line-height:1.8; flex:1 1 260px; }
.work-summary[data-tone="ask"] { border-inline-start-color:var(--amz-orange-ink,#D93800); }
.work-summary[data-tone="ok"] { border-inline-start-color:var(--app-success); }
.work-runtime { font-size:.8125rem; color:var(--app-muted); margin:-6px 0 12px; }
.commercial-page #workNotice { font-size:.875rem; padding:10px 14px; }
.commercial-page .work-task > header strong { overflow-wrap:anywhere; }
.commercial-page .work-task small { font-size:.8125rem; }
@media(max-width:575.98px) { .work-summary .btn { width:100%; } }
.app-page .bm-badge { font-size:.75rem; }
.app-page .bm-address a { display:inline-flex; align-items:center; min-height:32px; direction:ltr; }

/* Development chat: a status chip instead of a banner, and the conversation gets the screen. */
.runtime-chip { display:inline-flex; align-items:center; gap:6px; min-height:36px; padding:4px 10px; border-radius:999px; font-size:.8125rem; font-weight:600; border:1px solid var(--app-border); background:var(--app-surface); white-space:nowrap; }
.runtime-chip.is-ok { color:var(--app-success); }
.runtime-chip.is-warn { color:var(--app-warning); border-color:color-mix(in srgb,var(--app-warning) 35%,var(--app-border)); }
.runtime-detail { font-size:.8125rem; color:var(--app-muted); margin:0 0 8px; flex:0 0 auto; }
.project-agent-page .agent-page-header { font-size:.875rem; }
.project-agent-page .agent-suggestions button { font-size:.8125rem; min-height:36px; }
.project-agent-page .agent-composer-note { font-size:.75rem; }
@media(max-width:767.98px) {
  .project-agent-page .agent-page-header > div:first-child { display:none; }
  .project-agent-page .agent-page-header { min-height:0; margin-bottom:8px; justify-content:flex-start; }
  .project-agent-page .agent-global-state { flex-wrap:wrap; gap:6px; width:100%; }
  .project-agent-page .agent-global-state .agent-work-link { display:none; }
  .project-agent-page .runtime-chip span { max-width:44vw; overflow:hidden; text-overflow:ellipsis; }
  .project-agent-page .agent-composer-note { display:none; }
  .project-agent-page .agent-suggestions { display:none; }
  .project-agent-page .agent-page-main { padding:10px!important; }
}
/* The two mode buttons had no styles of their own and rendered white on white. */
.project-agent-page .agent-composer .agent-work-button { width:auto; height:40px; flex:0 0 auto; padding:0 12px; font-size:.8125rem; font-weight:700; white-space:nowrap; color:var(--app-primary); background:var(--app-primary-soft); border:1px solid color-mix(in srgb,var(--app-primary) 45%,var(--app-border)); border-radius:10px; }
.project-agent-page .agent-composer .agent-work-button.is-direct { color:var(--amz-on-ocean,#fff); background:var(--app-primary); border-color:var(--app-primary); }
.project-agent-page .agent-composer #agentSendBtn { width:40px; height:40px; flex:0 0 40px; color:var(--amz-on-ocean,#fff); }
.project-agent-page .agent-composer textarea { font-size:.9375rem; }
.project-agent-page .agent-panel-loading, .project-agent-page .agent-panel-empty { font-size:.8125rem; }
.project-agent-page #agentSettingsBtn { color:var(--app-text); }
@media(max-width:767.98px) {
  .project-agent-page .agent-composer { flex-wrap:wrap; padding:6px; }
  .project-agent-page .agent-composer textarea { flex:1 1 100%; font-size:1rem; min-height:44px; }
  .project-agent-page .agent-composer .agent-work-button { flex:1 1 auto; height:44px; }
  .project-agent-page .agent-composer #agentSendBtn { width:44px; height:44px; flex-basis:44px; }
  .project-agent-page .agent-global-state :is(#newAgentSessionBtn,#agentSettingsBtn) { font-size:0!important; width:44px!important; height:44px; padding:0!important; display:inline-grid; place-items:center; }
  .project-agent-page .agent-global-state :is(#newAgentSessionBtn,#agentSettingsBtn) i { font-size:1rem; margin:0; }
  .project-agent-page .agent-global-state { flex-wrap:nowrap; }
  .project-agent-page .runtime-chip { flex:1 1 auto; min-width:0; }
  .project-journey a { min-height:48px; }
}

/* Sources and knowledge. The project bar now links the four surfaces, so the page's own cross-links go;
   the drawer header repeated the project name the breadcrumb already shows. */
.knowledge-page-main .knowledge-page-breadcrumb .btn { display:none; }
.knowledge-page-main .knowledge-page-breadcrumb a { display:inline-flex; align-items:center; gap:6px; min-height:36px; }
.knowledge-page-main .workspace-drawer .workspace-header { display:none; }
.knowledge-page-main .workspace-drawer { max-width:100%; min-width:0; overflow-x:clip; }
/* stations.css loads after this file on the knowledge page, hence the .app-page prefix. */
.app-page .stn-title { font-size:.8125rem; }
.app-page .stn-detail { font-size:.75rem; }
.app-page .stn-dot { font-size:12px; }
@media(max-width:767.98px) {
  /* Seven stations: every one visible, four to a row, no sideways scrolling that hid three of them. */
  .app-page .stn-rail { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px 4px; overflow:visible; padding-bottom:12px; }
  .app-page .stn-step { min-width:0; min-height:56px; padding:2px; }
  .app-page .stn-step::before, .app-page .stn-detail { display:none; }
  .app-page .stn-title { font-size:.75rem; line-height:1.5; }
  /* On a phone the page scrolls, not a box inside it; only the chat keeps its own scroller. */
  .knowledge-page-main :is(.workspace-drawer,.workspace-body,.workspace-pane:not(.workspace-chat-pane)) { height:auto!important; max-height:none!important; overflow:visible!important; }
  .knowledge-page-main .workspace-file-toolbar { flex-wrap:wrap; gap:10px; }
  .knowledge-page-main .workspace-file-toolbar > div { min-width:0; }
  .knowledge-page-main .workspace-tabs:not(.d-none) { display:grid!important; grid-template-columns:repeat(2,minmax(0,1fr)); }
}

.app-page :is(.ai-rich-response,.plan-content) :is(pre,pre code) { font-size:.8125rem; }
.app-page :is(.ai-rich-response,.plan-content) .md-code-lang { font-size:.75rem; color:var(--app-muted); }

/* Review queue. */
.review-document-select { min-width:min(230px,100%); }
.review-graph-link { white-space:nowrap; min-height:44px; display:inline-flex; align-items:center; }
.rv-kbd-on-primary { border-color:rgba(255,255,255,.35)!important; background:rgba(255,255,255,.16)!important; color:inherit!important; }
.app-page .rv-kbd { font-size:.75rem; }
@media(max-width:767.98px) {
  #reviewMain .command-header-actions { width:100%; display:grid; grid-template-columns:minmax(0,1fr); gap:8px; }
  #reviewMain .command-header-actions label { width:100%; }
  #reviewMain .command-header-actions select { width:100%; min-height:44px; }
}
/* Review desk tokens: the third ink was 3.4:1 on white; the desk also still wore the pre-brand blue. */
:root:root { --rv-ink-3:#5b6477; --rv-brand:var(--amz-ocean,#0862A6); --rv-brand-deep:var(--amz-midnight,#003366); --rv-brand-ink:var(--amz-midnight,#003366); --rv-brand-soft:var(--amz-050,#EDF4FA); }
:root:root[data-theme="dark"] { --rv-ink-3:#a3aec0; --rv-brand:var(--amz-ocean); --rv-brand-deep:var(--amz-300); --rv-brand-ink:var(--amz-300); --rv-brand-soft:var(--amz-050); }
.rv-btn.is-primary { color:var(--amz-on-ocean,#fff)!important; }

/* Wallet ledger: zero-amount reservations only in pro view; below 768px each row is a card. */
body:not(.pro-view) .ledger-zero { display:none; }
body.pro-view .ledger-zero-note { display:none; }
.ledger-zero-note td { font-size:.8125rem; color:var(--app-muted); text-align:center; }
@media(max-width:767.98px) {
  .app-page table.table-cards, .app-page table.table-cards tbody, .app-page table.table-cards tr, .app-page table.table-cards td { display:block; width:100%; }
  .app-page table.table-cards { min-width:0!important; }
  .app-page table.table-cards thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
  .app-page table.table-cards tr { border:1px solid var(--app-border); border-radius:12px; padding:8px 12px; margin-bottom:10px; background:var(--app-surface); }
  .app-page table.table-cards td { display:grid; grid-template-columns:minmax(84px,34%) minmax(0,1fr); gap:10px; padding:6px 0!important; border:0!important; text-align:start; white-space:normal!important; overflow-wrap:anywhere; }
  .app-page table.table-cards td::before { content:attr(data-label); color:var(--app-muted); font-size:.8125rem; font-weight:600; }
  .app-page table.table-cards td:not([data-label])::before { content:none; }
  .app-page table.table-cards td:not([data-label]) { display:block; }
  body:not(.pro-view) table.table-cards tr.ledger-zero { display:none; }
  .app-page table.table-cards td.pro-only { display:none; }
  body.pro-view table.table-cards td.pro-only { display:grid; }
  .app-page .activity-table-wrap:has(table.table-cards) { overflow:visible; max-height:none; }
}
.app-page .text-success { color:var(--app-success)!important; }
.app-page .text-danger { color:var(--app-danger)!important; }
.app-page .breadcrumb a { display:inline-flex; align-items:center; min-height:32px; }
@media(max-width:767.98px) {
  .app-page table.table-cards thead { inset-inline-start:0; top:0; }
  /* Ledger cards: time and type on one line, then what it was and how much. Balances before/after are pro detail. */
  .app-page table.ledger-cards tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:2px 10px; }
  .app-page table.ledger-cards td { display:block; padding:2px 0!important; }
  .app-page table.ledger-cards td::before { content:none; }
  .app-page table.ledger-cards td[data-label="زمان"] { color:var(--app-muted); font-size:.8125rem; }
  .app-page table.ledger-cards td[data-label="شرح"], .app-page table.ledger-cards td[data-label="مبلغ"] { grid-column:1/-1; }
  .app-page table.ledger-cards td[data-label="مبلغ"] { font-size:1rem; }
  body.app-page:not(.pro-view) table.ledger-cards td:is([data-label="قبل"],[data-label="بعد"]) { display:none; }
  body.app-page.pro-view table.ledger-cards td:is([data-label="قبل"],[data-label="بعد"],[data-label="مرجع"]) { display:grid; grid-column:1/-1; grid-template-columns:minmax(84px,34%) minmax(0,1fr); }
  body.app-page.pro-view table.ledger-cards td:is([data-label="قبل"],[data-label="بعد"],[data-label="مرجع"])::before { content:attr(data-label); color:var(--app-muted); font-size:.8125rem; }
  .app-page table.ledger-cards tr.ledger-zero-note { display:block; }
}

/* API keys: the key box never outgrows its card; the copy button is always reachable. */
.app-page .key-prefix-box { display:flex!important; max-width:100%; min-width:0; }
.app-page .key-prefix-box .key-prefix-text { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1 1 auto; }
.app-page .copy-inline { min-width:40px; min-height:40px; display:inline-grid; place-items:center; flex:0 0 auto; }
.profile-pro-card { margin-top:16px; }
.profile-pro-switch { display:flex; align-items:center; gap:10px; min-height:44px; margin:0; padding-inline-start:0; }
.profile-pro-switch .form-check-input { width:3em; height:1.5em; margin:0; float:none; }
@media(max-width:767.98px) { .app-page :is(.agent-table-scroll,.table-responsive,.activity-table-wrap):has(table.table-cards) { overflow:visible!important; max-height:none!important; } }

/* Last small-text cases found by the audit. */
.app-page .dashboard-sync, .app-page .dashboard-sync span { font-size:.8125rem; }
.app-page .wz-eyebrow { font-size:.75rem; }
.app-page .app-admin-badge { font-size:.75rem; }
.app-page .md-inline-code { font-size:max(.75rem,.88em); }
.app-page .md-code-header :is(.md-code-lang,span) { font-size:.75rem; color:#cbd5e1; }
.app-page .project-chip { font-size:.75rem; }
.app-page .project-chip.free-key { color:var(--app-text); }
.app-page .btn-outline-secondary { color:var(--app-text); }
.agent-platform-page .agent-page-main > header :is(a,b), .agent-platform-page .agent-page-header :is(a,b) { font-size:.875rem; }
.agent-platform-page .agent-page-header a { display:inline-flex; align-items:center; min-height:32px; }
.agent-platform-page .agent-platform-banner { font-size:.875rem; }
.agent-platform-page .agent-role-chip { font-size:.75rem; }
.agent-platform-page td.agent-panel-empty { font-size:.8125rem; }
.agent-platform-page .organization-project-strip span { font-size:.75rem; }
.app-page .profile-security-pill { font-size:.8125rem; }
.app-page #profileFilesBadge { font-size:.75rem; }
.auth-page .auth-check.auth-terms { font-size:.875rem; line-height:1.8; }
.auth-page .reset-steps, .auth-page .reset-steps :is(span,b) { font-size:.8125rem; }
@media(max-width:767.98px) { .app-page table.table-cards thead { display:none; } }
.auth-page .auth-form-options :is(.auth-check,a) { font-size:.875rem!important; }
.auth-page .auth-kicker, .auth-page .auth-capabilities :is(strong,small), .auth-page .auth-steps :is(strong,small,b), .auth-page .auth-brand-panel footer :is(span,b), .auth-page .auth-security-note :is(strong,p) { font-size:.8125rem; }

/* Desktop leftovers from the audit. */
.app-page .app-profile-pill span { font-size:.875rem; }
.project-agent-page .agent-session-item :is(strong,small) { font-size:.8125rem; }
.project-agent-page .agent-session-item small { font-size:.75rem; }
.project-agent-page #showArchivedSessions { font-size:.8125rem; min-height:40px; }
.project-agent-page .agent-inspector-tabs button { font-size:.8125rem; }
.project-agent-page .agent-inspector-tabs button b { font-size:.75rem; }
.project-agent-page .pw-paths li { font-size:.75rem; }
.project-agent-page .agent-page-header a { display:inline-flex; align-items:center; min-height:32px; }
.project-agent-page .agent-search input { min-height:36px; font-size:.875rem; }
.app-page figcaption :is(span,button) { font-size:.75rem; }
.app-page figcaption button { min-height:32px; min-width:44px; }
/* Paged tables (20 rows) flow with the page instead of scrolling inside a 520px box. */
.app-page .activity-table-wrap { max-height:none!important; }
.agent-platform-page .agent-page-header span { font-size:.875rem; }
.project-agent-page .pw-body summary { min-height:32px; display:flex; align-items:center; }

/* Dark mode. The work panels asked for --amz-surface/--amz-ink-soft and --rv-surface, which nothing defined
   outside the review desk, so their white fallbacks stayed white under light text. */
:root, :root[data-theme="dark"] { --amz-surface:var(--app-surface); --amz-ink-soft:var(--app-muted); --rv-surface:var(--app-surface); }
.projects-page .project-card .project-open-action, .projects-page .project-card .project-open-action span { color:var(--amz-on-ocean,#fff); }
/* Rendered markdown in the design studio used fixed slate text colours made for a white page. */
:root[data-theme="dark"] .app-page :is(.ai-rich-response,.plan-content,#projectPlanBody,#chatMessagesContainer,.right-panel) :is(p,li,td,th,strong,em,b,h1,h2,h3,h4,h5,h6,.md-p,.md-h1,.md-h2,.md-h3,.md-h4,blockquote) { color:var(--app-text)!important; }
:root[data-theme="dark"] .app-page :is(.ai-rich-response,.plan-content,#projectPlanBody,#chatMessagesContainer) code:not(pre code) { color:#ffb4ae!important; }
:root[data-theme="dark"] .app-page :is(.ai-rich-response,.plan-content,#projectPlanBody,#chatMessagesContainer) :is(table,thead,tbody,tr,td,th) { background-color:var(--app-surface)!important; border-color:var(--app-border)!important; }
:root[data-theme="dark"] .app-page :is(.ai-rich-response,.plan-content,#projectPlanBody,#chatMessagesContainer) :is(thead th, tr:nth-child(even) td) { background-color:var(--app-elevated)!important; }
.app-page .profile-tabs button.active { color:var(--amz-on-ocean,#fff); }
:root[data-theme="dark"] .app-page .nav-pills .nav-link:not(.active) { color:var(--app-text); }
.app-page .knowledge-metrics span { font-size:.75rem; }
.app-page .project-chip.free-key { background:var(--app-elevated)!important; color:var(--app-text)!important; }
:root[data-theme="dark"] .app-page .btn-outline-danger:not(:hover) { color:var(--app-danger); border-color:var(--app-danger); }
:root[data-theme="dark"] .app-page .btn-outline-success:not(:hover) { color:var(--app-success); border-color:var(--app-success); }
:root[data-theme="dark"] .app-page .btn-outline-warning:not(:hover) { color:var(--app-warning); border-color:var(--app-warning); }
body.app-page.pro-view table.ledger-cards tr.ledger-zero-note, body.app-page.pro-view tr.ledger-zero-note { display:none; }
@media(max-width:767.98px) {
  /* Two fields per line: label above value. The first column (who/what) and the actions take a full line. */
  .app-page table.table-cards:not(.ledger-cards) tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px 12px; padding:10px 12px; }
  .app-page table.table-cards:not(.ledger-cards) td { display:block; padding:0!important; }
  .app-page table.table-cards:not(.ledger-cards) td::before { display:block; margin-bottom:1px; font-size:.75rem; }
  .app-page table.table-cards:not(.ledger-cards) td:first-child, .app-page table.table-cards:not(.ledger-cards) td:last-child:not([data-label]), .app-page table.table-cards:not(.ledger-cards) td[colspan] { grid-column:1/-1; }
  .app-page table.table-cards:not(.ledger-cards) td:first-child::before { content:none; }
  .app-page table.table-cards:not(.ledger-cards) td:first-child { font-weight:700; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Simple and pro modes: guides, advanced sections, step-by-step forms, presets.
   ════════════════════════════════════════════════════════════════════════════ */
.app-mode-switch { display:inline-flex; padding:3px; gap:2px; border:1px solid var(--app-border); border-radius:11px; background:var(--app-elevated); }
.app-mode-switch button { min-height:36px; padding:0 12px; border:0; border-radius:8px; background:transparent; color:var(--app-muted); font-size:.875rem; font-weight:600; }
.app-mode-switch button[aria-pressed="true"] { background:var(--app-surface); color:var(--app-primary); box-shadow:var(--app-shadow-sm); }
@media(max-width:575.98px) { .app-mode-switch button { padding:0 9px; font-size:.8125rem; } }

.ux-guide { display:grid; gap:6px; padding:14px 16px; margin:0 0 16px; border:1px solid color-mix(in srgb,var(--app-primary) 25%,var(--app-border)); border-inline-start:4px solid var(--app-primary); border-radius:12px; background:color-mix(in srgb,var(--app-primary) 5%,var(--app-surface)); color:var(--app-text); }
.ux-guide[hidden] { display:none; }
.ux-guide-head { display:flex; align-items:center; gap:8px; }
.ux-guide-head i { color:var(--app-primary); }
.ux-guide-head strong { flex:1; font-size:.9375rem; }
.ux-guide-close { width:36px; height:36px; display:grid; place-items:center; border:0; border-radius:8px; background:transparent; color:var(--app-muted); }
.ux-guide-close:hover { background:var(--app-elevated); color:var(--app-text); }
.ux-guide p { margin:0; font-size:.875rem; line-height:1.9; color:var(--app-text); }
.ux-guide ol { margin:0; padding-inline-start:20px; display:grid; gap:2px; font-size:.875rem; line-height:1.9; }
.ux-guide .ux-guide-tip { color:var(--app-muted); font-size:.8125rem; }
.ux-guide-reopen { display:inline-flex; align-items:center; gap:6px; min-height:32px; margin:0 0 12px; padding:0 10px; border:1px dashed var(--app-border); border-radius:8px; background:transparent; color:var(--app-primary); font-size:.8125rem; font-weight:600; }
.ux-guide-reopen[hidden] { display:none; }

details.adv-section { margin-top:12px; border:1px solid var(--app-border); border-radius:10px; background:var(--app-surface); }
details.adv-section > summary { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:44px; padding:8px 14px; cursor:pointer; list-style:none; font-size:.875rem; font-weight:600; color:var(--app-text); }
details.adv-section > summary::-webkit-details-marker { display:none; }
details.adv-section > summary small { color:var(--app-muted); font-weight:500; }
details.adv-section > summary span::after { content:" ▾"; color:var(--app-muted); }
details.adv-section[open] > summary span::after { content:" ▴"; }
details.adv-section > .adv-body { padding:4px 14px 14px; display:grid; gap:12px; }
.adv-note { margin:0; font-size:.8125rem; color:var(--app-muted); }

.uxw-progress { display:none; list-style:none; margin:0 0 14px; padding:0; gap:6px; counter-reset:uxw; }
.uxw.uxw-on .uxw-progress { display:flex; }
.uxw-progress li { flex:1; min-width:0; counter-increment:uxw; padding-top:8px; border-top:3px solid var(--app-border); font-size:.75rem; color:var(--app-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.uxw-progress li.is-done { border-top-color:var(--app-primary); }
.uxw-progress li.is-current { border-top-color:var(--app-primary); color:var(--app-primary); font-weight:700; }
.uxw-step { display:grid; gap:12px; }
.uxw-step[hidden] { display:none; }
.uxw:not(.uxw-on) .uxw-step + .uxw-step { margin-top:18px; padding-top:14px; border-top:1px solid var(--app-border); }
.uxw-head { display:grid; gap:2px; }
.uxw-head h6 { margin:0; font-size:1rem; font-weight:700; color:var(--app-text); }
.uxw-head p { margin:0; font-size:.875rem; color:var(--app-muted); line-height:1.8; }
.uxw-count { font-size:.75rem; color:var(--app-primary); font-weight:700; }
.uxw:not(.uxw-on) .uxw-count { display:none; }
.uxw-nav { display:flex; gap:8px; margin-inline-end:auto; }
.uxw-nav[hidden], .uxw-nav [hidden] { display:none!important; }
.uxw > .uxw-nav { margin-top:16px; justify-content:space-between; }

.ux-presets { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.ux-preset { display:inline-flex; align-items:center; gap:6px; min-height:36px; padding:0 12px; border:1px solid var(--app-border); border-radius:999px; background:var(--app-surface); color:var(--app-text); font-size:.8125rem; font-weight:600; }
.ux-preset small { font-size:.6875rem; padding:1px 6px; border-radius:999px; background:var(--app-primary-soft); color:var(--app-primary); font-weight:700; }
.ux-preset[aria-pressed="true"] { border-color:var(--app-primary); background:var(--app-primary-soft); color:var(--app-primary); }
.ux-hint { display:block; margin-top:6px; font-size:.8125rem; color:var(--app-muted); line-height:1.8; }
.ux-choice-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr)); gap:10px; }
.ux-choice { display:grid; gap:4px; text-align:start; padding:14px; border:1px solid var(--app-border); border-radius:12px; background:var(--app-surface); color:var(--app-text); }
.ux-choice strong { font-size:.9375rem; }
.ux-choice small { color:var(--app-muted); font-size:.8125rem; line-height:1.8; }
.ux-choice[aria-pressed="true"] { border-color:var(--app-primary); box-shadow:0 0 0 3px color-mix(in srgb,var(--app-primary) 16%,transparent); }
.ux-choice .ux-badge { justify-self:start; font-size:.6875rem; padding:1px 8px; border-radius:999px; background:var(--app-primary-soft); color:var(--app-primary); font-weight:700; }

/* Mode utilities and the page-specific pieces of simple mode. */
body.pro-view .simple-only { display:none!important; }
body.app-page:not(.pro-view) .pro-only-block { display:none!important; }
body.app-page:not(.pro-view) #submitTxModal .col-md-7.order-md-1 { flex:0 0 100%; max-width:100%; }
.ux-badge { display:inline-block; font-size:.6875rem; padding:1px 8px; border-radius:999px; background:var(--app-primary-soft); color:var(--app-primary); font-weight:700; vertical-align:middle; }
.agent-mode-hint { margin:6px auto 0; max-width:850px; font-size:.8125rem; line-height:1.8; color:var(--app-muted); }
.agent-mode-hint b { color:var(--app-text); }
@media(max-width:767.98px) {
  /* On a phone the explanation appears while typing, where the two buttons are. */
  .project-agent-page .agent-mode-hint { display:none; }
  body.project-agent-page:not(.pro-view) .agent-composer-wrap:focus-within .agent-mode-hint { display:block; }
}
.agent-simple-settings { display:grid; gap:14px; padding:16px; margin-bottom:16px; border:1px solid var(--app-border); border-radius:12px; background:var(--app-surface); }
.agent-simple-settings fieldset { border:0; margin:0; padding:0; display:grid; gap:8px; }
.agent-simple-settings legend { font-size:.9375rem; font-weight:700; margin-bottom:4px; }
.work-composer { display:grid; gap:6px; margin-bottom:6px; }
.work-composer .form-label { margin:6px 0 0; font-weight:600; }
.adv-tabs-toggle { display:inline-flex; align-items:center; gap:6px; min-height:44px; padding:0 14px; border:1px dashed var(--app-border); border-radius:10px; background:transparent; color:var(--app-primary); font-size:.875rem; font-weight:600; white-space:nowrap; }
body.app-page:not(.pro-view) [data-platform-tab].adv-tab { display:none; }
body.app-page:not(.pro-view) .show-adv [data-platform-tab].adv-tab { display:inline-flex; }
details.adv-section.adv-filters { margin-top:0; align-self:end; min-width:0; }
details.adv-section.adv-filters > .adv-body { grid-template-columns:repeat(auto-fit,minmax(min(100%,160px),1fr)); }
details.adv-section.adv-filters > .adv-body > .adv-note:empty { display:none; }
.project-index-toolbar details.adv-filters { flex:1 1 100%; }
/* Pro-mode content the simple audit could not see. */
.dashboard-v3 .agent-task-legend, .dashboard-v3 .agent-task-legend :is(span,strong) { font-size:.75rem; }
.dashboard-v3 .agent-production-metrics :is(small,em) { font-size:.75rem; }
.dashboard-v3 .dashboard-chart-details summary { min-height:36px; display:flex; align-items:center; }
:root[data-theme="dark"] .app-page code:not(pre code) { color:#ffb4ae; }
.dashboard-v3 #knowledgeSlots { font-size:.8125rem; }
.dashboard-v3 .knowledge-issue-line strong { font-size:.875rem; }
.dashboard-v3 .command-event strong { font-size:.8125rem; }

/* ── Dashboard: two layouts ─────────────────────────────────────────────── */
.dash-next { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:16px 24px; padding:22px 24px; border-radius:16px; background:var(--amz-gradient,linear-gradient(135deg,#003366,#0862A6)); color:#fff; }
.dash-next[data-tone="danger"] { background:linear-gradient(135deg,#5c1020,#9b1c31); }
.dash-next[data-tone="warning"] { background:linear-gradient(135deg,#4a3000,#8a5a06); }
.dash-next-copy { display:grid; gap:6px; flex:1 1 320px; min-width:0; }
.dash-next-eyebrow { font-size:.8125rem; font-weight:700; opacity:.85; }
.dash-next h2 { margin:0; font-size:1.25rem!important; color:#fff; line-height:1.6; }
.dash-next p { margin:0; font-size:.9375rem; line-height:1.9; color:#fff; opacity:.92; }
.dash-next-more { color:#fff; font-size:.875rem; text-decoration:underline; text-underline-offset:4px; justify-self:start; min-height:32px; display:inline-flex; align-items:center; }
.dash-next .dash-next-action { background:#fff!important; color:var(--amz-midnight,#003366)!important; border-color:#fff!important; font-weight:700; white-space:nowrap; }
@media(max-width:575.98px) { .dash-next { padding:18px; } .dash-next .dash-next-action { width:100%; } }

.dash-credit { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px 20px; padding:18px 20px; border:1px solid var(--app-border); border-inline-start:4px solid var(--app-success); border-radius:14px; background:var(--app-surface); }
.dash-credit[data-tone="warning"] { border-inline-start-color:var(--app-warning); }
.dash-credit-copy { display:grid; gap:4px; flex:1 1 280px; }
.dash-credit h2 { margin:0; font-size:1rem!important; color:var(--app-muted); }
.dash-credit strong { font-size:1.5rem; font-variant-numeric:tabular-nums; }
.dash-credit p { margin:0; font-size:.9375rem; }
.dash-credit small { color:var(--app-muted); font-size:.8125rem; }
.dash-credit-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }

.project-journey-mini { list-style:none; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; margin:0; padding:0; }
.project-journey-mini li { padding-top:6px; border-top:3px solid var(--app-border); font-size:.75rem; color:var(--app-muted); }
.project-journey-mini li.is-done { border-top-color:var(--app-success); color:var(--app-text); }
.project-journey-mini li.is-active { border-top-color:var(--app-primary); color:var(--app-primary); font-weight:700; }

.dash-table-wrap { padding:0 18px 18px; overflow-x:auto; }
.dash-table { margin:0; font-size:.875rem; }
.dash-table td, .dash-table th { vertical-align:top; }
.dash-table tr.is-danger td:first-child { box-shadow:inset -3px 0 0 var(--app-danger); }
.dash-table tr.is-warning td:first-child { box-shadow:inset -3px 0 0 var(--app-warning); }
.dash-table .dash-tone { color:var(--app-muted); }
.dash-table .pro-raw { display:block; margin-top:4px; font-size:.75rem; color:var(--app-muted); }
.dash-links { white-space:nowrap; }
.dash-links a { display:inline-grid; place-items:center; width:36px; height:36px; border-radius:8px; color:var(--app-primary); }
.dash-links a:hover { background:var(--app-primary-soft); }

/* Order: simple leads with the next step; pro leads with metrics and the decision queue. */
.dashboard-v3 > .dash-header { order:0; }
.dashboard-v3 > .dash-next { order:1; }
.dashboard-v3 > .today-card { order:2; }
.dashboard-v3 > .continuity-card { order:3; }
.dashboard-v3 > .dash-credit { order:4; }
.dashboard-v3 > .dashboard-sync { order:20; }
body.pro-view .dashboard-v3 > .dash-account { order:1; }
body.pro-view .dashboard-v3 > .dash-agents { order:2; }
body.pro-view .dashboard-v3 > .today-card { order:3; }
body.pro-view .dashboard-v3 > .agent-operations-grid { order:4; }
body.pro-view .dashboard-v3 > .knowledge-operations-grid { order:5; }
body.pro-view .dashboard-v3 > .continuity-card { order:6; }
body.pro-view .dashboard-v3 > .command-grid-insight { order:7; }
body.pro-view .dashboard-v3 { gap:14px; }
body.pro-view .dashboard-v3 .decision-kpi { min-height:96px; padding:12px 14px!important; }
/* The guide follows the next-step card, not the other way round. */
.dashboard-v3 > :is(.ux-guide,.ux-guide-reopen) { order:2; }
body.pro-view .dashboard-v3 > :is(.ux-guide,.ux-guide-reopen) { order:19; }
.dash-table .status-dot { font-size:.8125rem; }
.dash-table td > a:not(.btn) { display:inline-flex; align-items:center; min-height:32px; }

/* ── Projects: cards (simple) or table (pro) ─────────────────────────── */
.projects-page .project-card .project-actions { grid-template-columns:minmax(0,1fr) repeat(auto-fit,44px); }
body.app-page:not(.pro-view) .projects-page .project-card .project-actions, body.projects-page:not(.pro-view) .project-card .project-actions { grid-template-columns:minmax(0,1fr) repeat(3,44px); }
.project-more { position:relative; }
.project-more > summary { list-style:none; display:grid; place-items:center; width:44px; height:44px; border:1px solid var(--app-border); border-radius:9px; cursor:pointer; color:var(--app-muted); }
.project-more > summary::-webkit-details-marker { display:none; }
.project-more-menu { position:absolute; inset-inline-end:0; top:calc(100% + 6px); z-index:5; min-width:170px; display:grid; padding:6px; border:1px solid var(--app-border); border-radius:10px; background:var(--app-surface); box-shadow:var(--app-shadow); }
.project-more-menu button { display:flex; align-items:center; gap:8px; min-height:40px; padding:0 10px; border:0; border-radius:8px; background:transparent; color:var(--app-text); font-size:.875rem; text-align:start; }
.project-more-menu button:hover { background:var(--app-elevated); }
.project-more-menu button.is-danger { color:var(--app-danger); }
body.pro-view .project-more { display:none; }
.project-table-wrap { border:1px solid var(--app-border); border-radius:12px; background:var(--app-surface); }
.project-table { margin:0; font-size:.875rem; }
.project-table td:last-child { white-space:nowrap; }
.project-table td:last-child .btn { min-width:36px; min-height:36px; }
.project-table td > a { display:inline-flex; align-items:center; min-height:32px; }
.project-table td > a { min-width:32px; }

/* ── Development chat: conversation first (simple) or full IDE (pro) ─────── */
body.project-agent-page:not(.pro-view) #requestAgentReplanBtn, body.project-agent-page:not(.pro-view) #agentRunIteration { display:none!important; }
.agent-inspector-label { font-size:.8125rem; font-weight:600; }
body.project-agent-page:not(.pro-view) [data-agent-open="inspector"] { width:auto!important; padding-inline:10px; gap:6px; }
@media(min-width:1200px) {
  /* Simple mode on a wide screen: sessions and the conversation; status and files slide in on demand. */
  body.project-agent-page:not(.pro-view) .agent-ide { grid-template-columns:240px minmax(0,1fr)!important; }
  body.project-agent-page:not(.pro-view) .agent-inspector { position:fixed; top:72px; bottom:0; left:0; z-index:1032; width:min(92vw,440px); transform:translateX(-105%); visibility:hidden; box-shadow:20px 0 60px rgba(3,6,18,.2); transition:.25s; }
  body.project-agent-page.agent-inspector-open:not(.pro-view) .agent-inspector { transform:none; visibility:visible; }
  body.project-agent-page:not(.pro-view) :is([data-agent-open="inspector"], .agent-inspector [data-agent-close="inspector"]) { display:inline-flex!important; align-items:center; }
}
@media(max-width:1199.98px) { .agent-inspector-label { display:none; } }

/* ── Build and release: a path in simple mode, tabs and metrics in pro mode ── */
.work-stages { list-style:none; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin:0 0 16px; padding:0; }
.work-stage { width:100%; height:100%; display:flex; align-items:center; gap:10px; padding:12px; border:1px solid var(--app-border); border-radius:12px; background:var(--app-surface); color:var(--app-text); text-align:start; }
.work-stage:disabled { opacity:.55; cursor:default; }
.work-stage-dot { flex:0 0 32px; width:32px; height:32px; display:grid; place-items:center; border-radius:50%; border:2px solid var(--app-border); font-weight:700; font-size:.875rem; }
.work-stage.is-done .work-stage-dot { background:var(--app-success); border-color:var(--app-success); color:#fff; }
.work-stage.is-current { border-color:var(--app-primary); box-shadow:0 0 0 3px color-mix(in srgb,var(--app-primary) 15%,transparent); }
.work-stage.is-current .work-stage-dot { border-color:var(--app-primary); color:var(--app-primary); }
.work-stage[aria-current="true"] { background:var(--app-primary-soft); }
.work-stage-text { display:grid; min-width:0; }
.work-stage-text b { font-size:.9375rem; }
.work-stage-text small { font-size:.75rem; color:var(--app-muted); }
@media(max-width:767.98px) { .work-stages { grid-template-columns:repeat(2,minmax(0,1fr)); } }
body.commercial-page:not(.pro-view) .work-sections > .ux-tabs { display:none!important; }
body.commercial-page:not(.pro-view)[data-work-view="tabs"] section.ux-panel:has(#workStart) { display:none; }
body.commercial-page:not(.pro-view)[data-work-view="goal"] .work-sections { display:none; }

/* ── Review: one question with two answers (simple), the full desk (pro) ── */
.rv.is-simple .rv-wrap { grid-template-columns:minmax(0,1fr); max-width:760px; margin-inline:auto; }
.rv.is-simple .rv-kind .rv-chip:not(.is-warning):not(.is-error) { display:none; }
.rv-quick-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:8px; }
.rv-quick-btn { display:grid; justify-items:center; gap:4px; padding:18px 12px; border:2px solid var(--app-border); border-radius:14px; background:var(--app-surface); color:var(--app-text); text-align:center; }
.rv-quick-btn i { font-size:1.5rem; }
.rv-quick-btn b { font-size:1.0625rem; }
.rv-quick-btn small { font-size:.8125rem; color:var(--app-muted); line-height:1.7; }
.rv-quick-btn.is-yes i { color:var(--app-success); }
.rv-quick-btn.is-no i { color:var(--app-danger); }
.rv-quick-btn.is-yes:hover { border-color:var(--app-success); background:color-mix(in srgb,var(--app-success) 7%,var(--app-surface)); }
.rv-quick-btn.is-no:hover { border-color:var(--app-danger); background:color-mix(in srgb,var(--app-danger) 7%,var(--app-surface)); }
.rv-quick-btn:disabled { opacity:.6; }
.rv-quick-foot { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; margin-top:12px; }
.rv-quick-foot .rv-btn { min-height:44px; }
@media(max-width:420px) { .rv-quick-grid { grid-template-columns:minmax(0,1fr); } }

/* ── Wallet: weekly spending and runway (simple), ledger and requests (pro) ── */
.wallet-spend { height:100%; display:grid; gap:10px; align-content:start; padding:18px 20px; border:1px solid var(--app-border); border-radius:16px; background:var(--app-surface); }
.wallet-spend header { display:grid; gap:2px; }
.wallet-spend h2 { margin:0; font-size:.9375rem!important; color:var(--app-muted); }
.wallet-spend header strong { font-size:1.5rem; font-variant-numeric:tabular-nums; }
.wallet-spend header small { color:var(--app-muted); font-size:.8125rem; }
.wallet-runway { margin:0; font-size:.9375rem; }
.wallet-bars { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:6px; align-items:end; }
.wallet-bars li { display:grid; gap:4px; justify-items:center; }
.wallet-bar { display:flex; align-items:flex-end; width:100%; height:72px; border-radius:6px; background:var(--app-elevated); overflow:hidden; }
.wallet-bar i { display:block; width:100%; background:var(--app-primary); border-radius:6px 6px 0 0; }
.wallet-bars small { font-size:.75rem; color:var(--app-muted); }
.wallet-show-all { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; min-height:48px; margin:8px 0 16px; }
body.app-page:not(.pro-view):not(.wallet-show-all) .wallet-full { display:none!important; }
.api-usage-simple { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; padding:16px 18px; margin:16px 0; border:1px solid var(--app-border); border-radius:14px; background:var(--app-surface); }
.api-usage-simple h2 { margin:0 0 4px; font-size:.9375rem!important; color:var(--app-muted); }
.api-usage-simple p { margin:0; font-size:1rem; }
body.app-page:not(.pro-view) [aria-labelledby="api-financial-tab-usage"] { display:none!important; }

/* ── New project: wizard (simple) or one-screen form (pro) ─────────────── */
.quick-create { max-width:860px; margin:0 auto; display:grid; gap:16px; }
.quick-create header h1 { margin:0 0 4px; }
.quick-create header p { margin:0; color:var(--app-muted); }
.quick-create-grid { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(0,1fr); gap:14px; padding:20px; border:1px solid var(--app-border); border-radius:14px; background:var(--app-surface); }
.quick-create-grid label { display:grid; gap:6px; font-weight:600; font-size:.875rem; }
.quick-create-grid .quick-desc, .quick-create-grid .quick-actions { grid-column:1/-1; }
.quick-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; }
@media(max-width:575.98px) { .quick-create-grid { grid-template-columns:minmax(0,1fr); } }

/* ── Sources and knowledge: the guided rail (simple); rail plus direct tabs and full columns (pro) ── */
body.pro-view .knowledge-page-main .workspace-tabs.d-none { display:flex!important; margin-bottom:12px; }
body.app-page:not(.pro-view) .workspace-files-table :is(th,td):is(:nth-child(2),:nth-child(3),:nth-child(5)) { display:none; }
body.app-page:not(.pro-view) .knowledge-metrics > div:is(:nth-child(1),:nth-child(2)) { display:none; }
.knowledge-page-main .workspace-tabs b { font-size:.75rem; }
.knowledge-page-main [data-workspace-pane="logs"] button { font-size:.8125rem; min-height:36px; }
.dash-table td > a:not(.btn) { min-width:32px; }
.dashboard-v3 .dash-next .btn.dash-next-action { background:#fff!important; color:var(--amz-midnight,#003366)!important; border-color:#fff!important; }
:root[data-theme="dark"] .dashboard-v3 .dash-next .btn.dash-next-action { color:#04101C!important; }
body.app-page:not(.pro-view) .dash-header .system-health { display:none; }
.dashboard-v3 > .today-card[hidden] { display:none; }

/* ── The project's next step (simple mode, every project page) ────────────── */
.project-next-bar { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"copy action" "dots action"; align-items:center; gap:8px 18px; padding:14px 18px; margin:0 0 16px; border:1px solid color-mix(in srgb,var(--app-primary) 30%,var(--app-border)); border-radius:14px; background:color-mix(in srgb,var(--app-primary) 5%,var(--app-surface)); }
.project-next-bar[hidden] { display:none; }
.project-next-bar[data-state="waiting"] { border-color:color-mix(in srgb,var(--amz-orange-ink,#D93800) 45%,var(--app-border)); background:color-mix(in srgb,var(--amz-orange,#FF4200) 6%,var(--app-surface)); }
.pnb-copy { grid-area:copy; display:grid; gap:2px; min-width:0; }
.pnb-eyebrow { font-size:.75rem; font-weight:700; color:var(--app-primary); }
.pnb-copy strong { font-size:1rem; }
.pnb-copy p { margin:0; font-size:.875rem; line-height:1.8; color:var(--app-text); }
.pnb-detail { color:var(--app-muted); }
.pnb-dots { grid-area:dots; display:flex; gap:4px; }
.pnb-dots i { width:22px; height:6px; border-radius:3px; background:var(--app-border); }
.pnb-dots i.is-done { background:var(--app-success); }
.pnb-dots i:is(.is-active,.is-waiting) { background:var(--app-primary); }
.pnb-dots i.is-waiting { background:var(--amz-orange-ink,#D93800); }
.pnb-action { grid-area:action; white-space:nowrap; min-height:44px; }
@media(max-width:575.98px) {
  .project-next-bar { grid-template-columns:minmax(0,1fr); grid-template-areas:"copy" "dots" "action"; padding:12px 14px; }
  .pnb-action { width:100%; }
}
.project-agent-page .project-next-bar { flex:0 0 auto; margin-bottom:10px; }
@media(max-width:767.98px) {
  /* The chat keeps its screen: on a phone the bar shrinks to its sentence and button. */
  .project-agent-page .project-next-bar :is(.pnb-dots,.pnb-copy p) { display:none; }
}

/* ── Files: a drop area (simple mode) ──────────────────────────────────────── */
.files-dropzone { display:grid; justify-items:center; gap:6px; margin:12px 0 16px; padding:26px 18px; border:2px dashed color-mix(in srgb,var(--app-primary) 45%,var(--app-border)); border-radius:14px; background:color-mix(in srgb,var(--app-primary) 4%,var(--app-surface)); text-align:center; cursor:pointer; }
.files-dropzone i { font-size:1.75rem; color:var(--app-primary); }
.files-dropzone strong { font-size:1rem; }
.files-dropzone small { color:var(--app-muted); font-size:.8125rem; line-height:1.8; max-width:52ch; }
.files-dropzone.is-over { border-style:solid; background:var(--app-primary-soft); }
.files-queue { font-size:.875rem; font-weight:600; color:var(--app-primary); min-height:1.2em; }
body.app-page:not(.pro-view) #projectFileUploadBtn { display:none; }
.app-page :is(.ux-guide ol, .today-list ol, .rv ol) { list-style-type:persian; }
.knowledge-page-main .knowledge-page-breadcrumb { margin-bottom:10px; }
@media(max-width:767.98px) {
  /* Simple mode on a phone: the starter requests appear while typing, where they are useful. */
  body.project-agent-page:not(.pro-view) .agent-composer-wrap:focus-within .agent-suggestions { display:flex!important; flex-wrap:nowrap; overflow-x:auto; gap:6px; padding-bottom:4px; }
}
@media(max-width:767.98px) {
  .project-agent-page .project-next-bar { grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"copy action"; padding:8px 12px; gap:8px; }
  .project-agent-page .project-next-bar .pnb-copy strong { font-size:.875rem; }
  .project-agent-page .project-next-bar .pnb-eyebrow { display:none; }
  .project-agent-page .project-next-bar .pnb-action { width:auto; min-height:40px; padding:6px 12px; font-size:.8125rem; }
  .project-agent-page .project-journey { margin-bottom:8px; }
}
.project-stations-mini { display:flex; align-items:center; gap:3px; }
.project-stations-mini i { flex:1; height:5px; border-radius:3px; background:var(--app-border); }
.project-stations-mini i.is-done { background:var(--app-success); }
.project-stations-mini i:is(.is-active,.is-waiting) { background:var(--app-primary); }
.project-stations-mini small { flex:0 0 auto; margin-inline-start:6px; font-size:.75rem; color:var(--app-muted); }

/* «What now?» card after an upload queue or a knowledge build finishes (guided.js nextUp). */
.ux-nextup { position:fixed; z-index:1080; bottom:16px; inset-inline:16px; max-width:480px; margin-inline:auto; display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px 12px; align-items:start; padding:14px 16px; border-radius:14px; background:var(--app-surface-solid); color:var(--app-text); border:1px solid var(--app-border); box-shadow:0 12px 32px rgba(8,22,40,.18); opacity:0; transform:translateY(12px); transition:opacity .2s ease, transform .2s ease; }
.ux-nextup.is-in { opacity:1; transform:none; }
.ux-nextup-icon { width:36px; height:36px; border-radius:50%; display:grid; place-items:center; background:color-mix(in srgb, var(--app-success) 14%, transparent); color:var(--app-success); }
.ux-nextup[data-tone="info"] .ux-nextup-icon { background:color-mix(in srgb, var(--app-primary) 14%, transparent); color:var(--app-primary); }
.ux-nextup-copy strong { display:block; font-size:.9375rem; }
.ux-nextup-copy p { margin:4px 0 0; font-size:.8125rem; line-height:1.7; color:var(--app-muted); }
.ux-nextup-actions { grid-column:1 / -1; display:flex; gap:8px; justify-content:flex-end; align-items:center; }
.ux-nextup-actions .btn { min-height:40px; }
@media (prefers-reduced-motion: reduce) { .ux-nextup { transition:none; } }


/* Sign-up: the hints under a field are read, not decoration (style.css had them at .55rem). */
.auth-page :is(#mobileHint, #passwordMatch, #referralStatus, .password-strength small) { display:block; margin-top:4px; font-size:.75rem; line-height:1.6; color:var(--app-muted); }

/* Dev chat: the assistant's Markdown, and its long reports behind «گزارش کامل» in simple mode. */
.pw-msg-body .ai-rich-response { display:grid; gap:6px; min-width:0; }
.pw-msg-body .ai-rich-response > * { margin:0; }
.pw-msg-body .ai-rich-response :is(table) { display:block; max-width:100%; overflow-x:auto; font-size:.8125rem; }
.pw-msg-body .ai-rich-response code { font-size:.8125rem; direction:ltr; unicode-bidi:isolate; overflow-wrap:anywhere; }
.pw-msg-lead { margin:0; }
.pw-msg-body details.pw-msg-full { border:0; background:none; margin-top:4px; }
.pw-msg-body details.pw-msg-full > summary { min-height:36px; padding:4px 0; font-size:.8125rem; }
body.pro-view .pw-msg-body details.pw-msg-full { margin-top:0; }

/* Top-up: a missing deposit address says so instead of showing a placeholder; the tx id checks itself. */
#walletAddressSection.is-missing .wallet-address-text { direction:rtl; text-align:right; font-family:inherit; font-size:.875rem; color:var(--app-danger); }
#walletAddressSection .copy-btn:disabled { opacity:.5; }
.deposit-missing { margin:10px 0 0; padding:10px 12px; border-radius:10px; font-size:.8125rem; line-height:1.8; color:var(--app-text); background:color-mix(in srgb, var(--app-danger) 9%, var(--app-surface-solid)); border:1px solid color-mix(in srgb, var(--app-danger) 30%, var(--app-border)); }
.tx-hash-note[data-state="ok"] { color:var(--app-success); }
.tx-hash-note[data-state="bad"] { color:var(--app-danger); }

/* ── Model answers (ai-renderer.js): readable type, the model's own tags as callouts and sections,
      long answers folded inside a conversation. ─────────────────────────────────────────────── */
.app-page .ai-rich-response { font-size:.9375rem; line-height:1.95; }
.app-page .ai-rich-response :is(h2,h3,h4,h5,h6) { scroll-margin-top:12px; }
.app-page .ai-rich-response h2 { font-size:1.0625rem; }
.app-page .ai-rich-response h3 { font-size:1rem; }
.app-page .ai-rich-response :is(h4,h5,h6) { font-size:.9375rem; }
.app-page .ai-rich-response [dir="ltr"] { text-align:left; }
.app-page .ai-rich-response ol { list-style-type:persian; }
.app-page .ai-rich-response :is(ul,ol) :is(ul,ol) { margin:.2em 0 .3em; }
.app-page .ai-rich-response ul ul { list-style-type:circle; }
.app-page .ai-rich-response li::marker { color:var(--app-primary); font-weight:700; }
.app-page .ai-rich-response li[dir="ltr"] { direction:ltr; }
.app-page .ai-rich-response code.ai-tag { color:var(--app-primary); background:color-mix(in srgb,var(--app-primary) 8%,var(--app-elevated)); border-color:color-mix(in srgb,var(--app-primary) 18%,var(--app-border)); }
.app-page .ai-rich-response blockquote { color:var(--app-text); border-right:0; border-inline-start:3px solid var(--app-primary); border-radius:8px; }
.app-page .ai-rich-response blockquote > :last-child { margin-bottom:0; }
.app-page .ai-rich-response hr { margin:1.2em 0; border:0; border-top:1px solid var(--app-border); opacity:1; }
.app-page .ai-rich-response dl { margin:.35em 0; }
.app-page .ai-rich-response dd { color:var(--app-text); }

.ai-callout { --tone:var(--app-primary); margin:.9em 0; padding:10px 14px 12px; border:1px solid color-mix(in srgb,var(--tone) 30%,var(--app-border)); border-radius:12px; background:color-mix(in srgb,var(--tone) 7%,var(--app-surface-solid)); }
.ai-callout > header { display:flex; align-items:center; gap:8px; margin-bottom:4px; font-size:.875rem; font-weight:800; color:var(--tone); }
.ai-callout > :last-child { margin-bottom:0; }
.ai-callout.is-tip { --tone:var(--app-success); }
.ai-callout.is-important { --tone:var(--amz-orange-ink,#D93800); }
.ai-callout.is-warning { --tone:var(--amz-orange-ink,#B45309); }
.ai-callout.is-danger { --tone:var(--app-danger); }
.ai-callout.is-question { --tone:var(--amz-orange-ink,#D93800); }
.ai-callout.is-example { --tone:var(--app-muted); }
.ai-callout.is-decision { --tone:var(--amz-midnight,#003366); }
:root[data-theme="dark"] .ai-callout.is-decision { --tone:#8fb8ff; }
.ai-section { margin:1em 0; padding-inline-start:12px; border-inline-start:3px solid color-mix(in srgb,var(--app-primary) 45%,var(--app-border)); }
.ai-section > header { margin-bottom:4px; font-size:.8125rem; font-weight:800; color:var(--app-primary); }
.ai-section > :last-child { margin-bottom:0; }
.app-page .ai-reasoning > summary { display:flex; align-items:center; gap:8px; min-height:40px; font-size:.875rem; list-style:none; }
.app-page .ai-reasoning > summary::-webkit-details-marker { display:none; }
.app-page .ai-reasoning > summary::after { content:"\f078"; margin-inline-start:auto; font:var(--fa-font-solid, 900 1em "Font Awesome 7 Free"); font-weight:900; font-size:.7rem; transition:transform .2s; }
.app-page .ai-reasoning[open] > summary::after { transform:rotate(180deg); }
.app-page .ai-reasoning.is-live > summary i { animation:ai-pulse 1.2s ease-in-out infinite; }
.app-page .ai-data pre { max-height:320px; margin:0; padding:10px 12px; overflow:auto; border-radius:8px; background:var(--app-surface-solid); font-size:.8125rem; }
@keyframes ai-pulse { 50% { opacity:.35; } }
.app-page .ai-code figcaption { font-size:.75rem; }
.app-page .ai-code button { min-height:32px; padding:0 8px; font-size:.75rem; }
.app-page .ai-code pre code { font-size:.8125rem; }
.app-page .ai-code.is-streaming figcaption span { color:#8fd3ff; }
.app-page .ai-table-wrap table { font-size:.875rem; }
.app-page .ai-table-wrap :is(th,td) { vertical-align:top; line-height:1.8; }
.app-page .ai-table-wrap tbody tr:nth-child(even) td { background:color-mix(in srgb,var(--app-elevated) 70%,transparent); }
.app-page .ai-table-wrap td.is-num { font-variant-numeric:tabular-nums; white-space:nowrap; }
.app-page .ai-table-wrap [dir="ltr"] { text-align:left; }

/* A long answer, folded inside a conversation. */
.ai-rich-response.is-folded { max-height:var(--fold-h,420px); overflow:hidden; -webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 88px),transparent); mask-image:linear-gradient(to bottom,#000 calc(100% - 88px),transparent); }
.ai-fold-bar { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; margin-top:8px; }
.ai-fold-toggle { display:inline-flex; align-items:center; gap:8px; min-height:36px; padding:4px 14px; border:1px solid color-mix(in srgb,var(--app-primary) 35%,var(--app-border)); border-radius:999px; background:var(--app-surface-solid); color:var(--app-primary); font-size:.8125rem; font-weight:700; }
.ai-fold-toggle:hover { background:color-mix(in srgb,var(--app-primary) 8%,var(--app-surface-solid)); }
.ai-fold-meta { font-size:.75rem; color:var(--app-muted); }
.ai-fold-toc { display:flex; flex-wrap:wrap; gap:6px; flex-basis:100%; }
.ai-fold-toc[hidden], .ai-fold-meta[hidden] { display:none; }
.ai-fold-toc button { max-width:100%; min-height:32px; padding:2px 10px; overflow:hidden; border:1px solid var(--app-border); border-radius:8px; background:var(--app-elevated); color:var(--app-text); font-size:.75rem; text-overflow:ellipsis; white-space:nowrap; }
.ai-fold-toc button:hover { border-color:var(--app-primary); color:var(--app-primary); }
@media (prefers-reduced-motion: reduce) { .app-page .ai-reasoning.is-live > summary i { animation:none; } }

/* ── Conversations get the screen ───────────────────────────────────────────────────────────── */
/* A guide read once waits as one line (app-shell.js foldGuide). */
.ux-guide-fold { width:36px; height:36px; display:grid; place-items:center; border:0; border-radius:8px; background:transparent; color:var(--app-muted); }
.ux-guide-fold:hover { background:var(--app-elevated); color:var(--app-text); }
.ux-guide.is-folded { gap:0; padding:4px 10px 4px 12px; }
.ux-guide.is-folded > :not(.ux-guide-head) { display:none; }
.ux-guide.is-folded .ux-guide-head strong { cursor:pointer; font-size:.875rem; }

/* On a project page the next step is one line; the full sentence is in its tooltip. */
body:is(.project-agent-page,.project-knowledge-page) .project-next-bar { grid-template-columns:auto minmax(0,1fr) auto; grid-template-areas:"dots copy action"; gap:6px 14px; padding:8px 14px; margin-bottom:10px; }
body:is(.project-agent-page,.project-knowledge-page) .project-next-bar :is(.pnb-eyebrow,.pnb-detail) { display:none; }
body:is(.project-agent-page,.project-knowledge-page) .pnb-copy { display:flex; align-items:baseline; gap:10px; min-width:0; }
body:is(.project-agent-page,.project-knowledge-page) .pnb-copy strong { flex:0 0 auto; font-size:.9375rem; }
body:is(.project-agent-page,.project-knowledge-page) .pnb-copy p { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:.8125rem; color:var(--app-muted); }
body:is(.project-agent-page,.project-knowledge-page) .pnb-dots i { width:12px; }
body:is(.project-agent-page,.project-knowledge-page) .pnb-action { width:auto; min-height:38px; padding:6px 14px; font-size:.875rem; }
@media(max-width:767.98px) {
  body:is(.project-agent-page,.project-knowledge-page) .project-next-bar { grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"copy action"; padding:8px 12px; }
  body:is(.project-agent-page,.project-knowledge-page) .project-next-bar :is(.pnb-dots,.pnb-copy p) { display:none; }
}

/* Dev chat: once a conversation is under way, the starters and the mode note wait for the composer. */
.project-agent-page .agent-conversation:has(#agentMessages :is(.pw-msg,.agent-message)) .agent-composer-wrap:not(:focus-within) :is(.agent-suggestions,.agent-mode-hint) { display:none!important; }
.project-agent-page .agent-conversation-header { padding-block:8px; }

/* The knowledge chat: the conversation box is one screen tall under the top bar
   (guided.js chatScreen sets --chat-screen), and the page opens scrolled to it once it holds messages. */
@media(min-width:992px) {
  .project-knowledge-page.chat-focus .workspace-drawer.chat-screen { height:var(--chat-screen,640px)!important; min-height:0!important; }
}
@media(max-width:991.98px) {
  .knowledge-page-main .workspace-chat-pane.active, .knowledge-page-main .workspace-pane[data-workspace-pane="advisor"].active { height:var(--chat-screen,640px)!important; overflow:hidden!important; }
}
.project-knowledge-page.chat-focus .stn-rail .stn-detail { display:none; }
.project-knowledge-page.chat-focus .stn-step { min-height:0; padding-block:6px; }
.workspace-chat-pane:has(.knowledge-message) .knowledge-chat-suggestions { display:none; }
.workspace-chat-pane:has(.knowledge-message):focus-within .knowledge-chat-suggestions { display:flex; }

/* Dev chat, simple mode: «گزارش کامل» sits in the message's header row instead of a row of its own,
   and the composer's note waits for the composer like the starters do. */
.project-agent-page .pw-msg.is-model { position:relative; }
body.project-agent-page:not(.pro-view) .pw-msg.is-model:has(> .pw-msg-body > .pw-msg-full) > header { padding-inline-end:112px; }
body.project-agent-page:not(.pro-view) .pw-msg.is-model:has(> .pw-msg-body > .pw-msg-full) > header small { margin-inline-start:4px; }
body.project-agent-page:not(.pro-view) .pw-msg-body details.pw-msg-full { margin:0; }
body.project-agent-page:not(.pro-view) .pw-msg-body details.pw-msg-full > summary { position:absolute; inset-block-start:7px; inset-inline-end:10px; min-height:28px; padding:0 10px; gap:6px; border:1px solid var(--app-border); border-radius:999px; background:var(--app-surface-solid); font-size:.75rem; }
body.project-agent-page:not(.pro-view) .pw-msg-body details.pw-msg-full[open] > .ai-rich-response { margin-top:8px; }
.pw-msg-body .ai-rich-response { white-space:normal; }
.project-agent-page .agent-conversation:has(#agentMessages :is(.pw-msg,.agent-message)) .agent-composer-wrap:not(:focus-within) .agent-composer-note { display:none; }
/* The sections of a folded answer: one row that scrolls sideways, never a wall of buttons. */
.ai-fold-toc { flex-wrap:nowrap; overflow-x:auto; padding-bottom:2px; scrollbar-width:thin; }
.ai-fold-toc button { flex:0 0 auto; max-width:240px; }
/* One row for the fold controls: toggle, reading time, then the sections scrolling sideways. */
.ai-fold-bar { flex-wrap:nowrap; }
.ai-fold-toggle, .ai-fold-meta { flex:0 0 auto; }
.ai-fold-toc { flex:1 1 auto; flex-basis:auto; min-width:0; }
.ai-rich-response.is-folded { -webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 56px),transparent); mask-image:linear-gradient(to bottom,#000 calc(100% - 56px),transparent); }
@media(max-width:575.98px) { .ai-fold-meta { display:none; } }
/* The drawer's grid has three rows and the page mode hides its header, so the body fell into the second,
   auto-sized row and the stretching row stayed empty under the chat. While a chat is open, the body
   takes the stretching row and the conversation reaches the bottom of the box. */
.project-knowledge-page.chat-focus .workspace-drawer > .workspace-body { grid-row:-2 / -1; height:auto!important; min-height:0; }
.project-knowledge-page.chat-focus .workspace-chat-pane.active, .project-knowledge-page.chat-focus .workspace-pane[data-workspace-pane="advisor"].active { height:100%; }

/* Conversation pages on a phone: the project bar is one 40px row, the current section named and the
   others as icons (their names stay for screen readers and as tooltips), so the thread starts higher. */
@media(max-width:767.98px) {
  body:is(.project-agent-page,.chat-focus) .project-journey { grid-template-columns:auto auto auto auto; justify-content:space-between; gap:2px; padding:3px; margin-bottom:8px; }
  body:is(.project-agent-page,.chat-focus) .project-journey a { flex-direction:row; gap:6px; min-height:40px; padding:4px 12px; }
  body:is(.project-agent-page,.chat-focus) .project-journey a:not(.is-current) span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
  body:is(.project-agent-page,.chat-focus) .project-journey a.is-current span { white-space:nowrap; font-size:.8125rem; }
  body:is(.project-agent-page,.chat-focus) .project-journey a:not(.is-current) { min-width:48px; }
  .project-agent-page .agent-page-header { margin-bottom:6px; }
  .project-agent-page .agent-global-state { min-height:0; }
  .project-agent-page .agent-conversation-header { padding-block:6px; }
}
/* Chat details the audit found once the chats were on screen. */
body.project-agent-page:not(.pro-view) .pw-msg-body details.pw-msg-full > summary { min-height:32px; }
.app-page .knowledge-chat-status span { font-size:.8125rem; }
.app-page .knowledge-chat-suggestions button { font-size:.8125rem; min-height:36px; }
.app-page .stn-step.is-waiting .stn-dot { background:var(--amz-orange-ink,#B83000); color:#fff; }
/* A short screen (a phone on its side, a small laptop window): the dev chat stops fitting the page to
   the screen, the page scrolls instead, and the thread keeps room for a few messages. */
@media(max-height:700px) {
  body.project-agent-page .main-content > .agent-page-main { height:auto!important; min-height:calc(100dvh - 72px); }
  .project-agent-page #agentMessages { flex:none; height:max(260px, 62dvh); }
}
/* The knowledge map's own chat (knowledge pane, profile) had a fixed 378px box: a single answer filled it. */
.app-page .ct-chat-messages { max-height:min(64dvh,680px); }
/* The blueprint advisor: its host was a plain block, so the thread grew past the box and the composer
   ended up screens below. As a column, the thread scrolls and the composer stays at the bottom. */
#workspaceAdvisorHost { display:flex; flex-direction:column; min-height:0; overflow:hidden; }
#workspaceAdvisorHost > :is(.adv-thread,.adv-thread-wrap) { flex:1 1 auto; min-height:0; }

/* Several files sent together: one row each, with its own stage and progress (projects.js). */
.upload-queue { display:grid; gap:8px; margin:12px 0; padding:12px 14px; border:1px solid var(--app-border); border-radius:12px; background:var(--app-surface-solid); }
.upload-queue[hidden] { display:none; }
.upload-queue > header { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 12px; }
.upload-queue > header span { font-size:.8125rem; color:var(--app-muted); }
.upload-queue ol { list-style:none; margin:0; padding:0; display:grid; gap:6px; max-height:320px; overflow-y:auto; }
.upload-row { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(0,2fr) 90px 44px; align-items:center; gap:10px; padding:6px 8px; border-radius:8px; background:var(--app-elevated); font-size:.8125rem; }
.upload-name { font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.upload-message { color:var(--app-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.upload-track { height:6px; border-radius:3px; background:var(--app-border); overflow:hidden; }
.upload-track i { display:block; height:100%; background:var(--app-primary); transition:width .3s ease; }
.upload-percent { font-variant-numeric:tabular-nums; text-align:end; }
.upload-row[data-phase="ready"] .upload-track i { background:var(--app-success); }
.upload-row[data-phase="error"] { background:color-mix(in srgb,var(--app-danger) 8%,var(--app-surface-solid)); }
.upload-row[data-phase="error"] .upload-message { color:var(--app-danger); white-space:normal; }
.upload-row[data-phase="error"] .upload-track i { background:var(--app-danger); }
@media(max-width:767.98px) { .upload-row { grid-template-columns:minmax(0,1fr) 44px; } .upload-message { grid-column:1 / -1; white-space:normal; } .upload-track { grid-column:1 / -1; } .upload-percent { grid-row:1; grid-column:2; } }
