/* Shared responsive layer.  Page-specific styles stay in static/pages/. */
:root { color-scheme: light; }
:root { --workspace-gutter: 22px; --workspace-content-max: 1920px; }
html.embed { --workspace-gutter: 12px; }
html .workspace-content-width {
  box-sizing:border-box; width:100%; min-width:0; max-width:var(--workspace-content-max);
  margin-inline:auto; padding-inline:var(--workspace-gutter);
}
html .workspace-content-header {
  padding-inline:max(var(--workspace-gutter), calc((100% - var(--workspace-content-max)) / 2 + var(--workspace-gutter)));
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; }
button, [role="button"], input, select, textarea { touch-action: manipulation; }
img, video { max-width: 100%; height: auto; }
.table-scroll, .table-wrap, .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

:is(.offer-feature-tabs, .workspace-feature-tabs) {
  display:flex; gap:8px; padding:10px var(--workspace-gutter) 0;
  background:var(--surface); border-bottom:1px solid var(--border); overflow-x:auto;
}
.workspace-feature-tabs[hidden] { display:none; }
:is(.offer-feature-tabs, .workspace-feature-tabs) > :is(a, button) {
  display:inline-flex; align-items:center; justify-content:center; min-height:44px;
  padding:8px 16px; border:0; border-radius:8px 8px 0 0; border-bottom:3px solid transparent;
  background:transparent; color:var(--nav-text); font:inherit; font-weight:650; white-space:nowrap;
  text-decoration:none; cursor:pointer;
}
:is(.offer-feature-tabs, .workspace-feature-tabs) > :is(:hover, [aria-current="page"], [aria-selected="true"]) {
  background:var(--brand-soft); color:var(--brand);
}
:is(.offer-feature-tabs, .workspace-feature-tabs) > :is([aria-current="page"], [aria-selected="true"]) { border-bottom-color:var(--brand); }
:is(.offer-feature-tabs, .workspace-feature-tabs) > :focus-visible { outline-offset:-3px; }

/* Shared professional-blue visual language. Page layouts and behavior remain local. */
:root {
  --brand:#1976d2; --brand-dark:#0f5fac; --brand-soft:#edf6ff;
  --brand-soft-border:#cfe5fb; --brand-soft-text:#1769aa;
  --nav-bg:#ffffff; --nav-border:#e5edf6; --nav-text:#52657a; --nav-title:#172033;
  --bg:#f6f8fb; --surface:#ffffff; --card:#ffffff; --panel:#f9fbfd;
  --border:#e1e9f2; --line:#e1e9f2; --text:#172033; --ink:#172033;
  --muted:#697b90; --accent:#1976d2; --soft:#edf6ff;
  --radius:12px; --shadow:0 8px 24px rgba(25,54,88,.07);
}
body { color:var(--text, var(--ink)); background:var(--bg); }

/* Soybean Admin tokens when embedded in upgraded workspace shell */
:root[data-console="upgraded"] {
  --brand:#646cff;
  --brand-dark:#4f57e6;
  --brand-soft:rgba(100,108,255,.12);
  --brand-soft-border:rgba(100,108,255,.28);
  --brand-soft-text:#646cff;
  --bg:rgb(247,250,252);
  --accent:#646cff;
  --soft:rgba(100,108,255,.1);
  --radius:6px;
  --shadow:0 1px 2px rgb(0,21,41,.08);
}
:root[data-console="upgraded"] .account-avatar {
  background:var(--brand-soft);
  color:var(--brand);
}
:root[data-console="upgraded"] .account-action:hover,
:root[data-console="upgraded"] .logout:hover {
  color:var(--brand);
}
:root[data-console="upgraded"] ::selection {
  background:rgba(100,108,255,.22);
}
a { color:var(--brand); }
button, input, select, textarea { -webkit-tap-highlight-color:transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline:3px solid rgba(25,118,210,.22); outline-offset:2px; }
::selection { background:#cfe8ff; color:#172033; }

/* Equity ledger keeps its Excel-like grid, with the same blue surface system. */
html body .page .btn { border-radius:8px; border-color:#d4e0ec; }
html body .page .btn:hover { border-color:#8fc3ef; background:#f7fbff; }
html body .page .btn.primary { background:#1976d2; border-color:#1976d2; }
html body .page .btn.primary:hover { background:#0f5fac; }
html body .page .source { border-color:#dbe5ef; border-radius:9px; color:#52657a; box-shadow:0 5px 16px rgba(25,54,88,.04); }
html body .page .table-card { border-color:#dbe5ef; border-radius:10px; box-shadow:0 8px 24px rgba(25,54,88,.06); }
html body .page .equity-table thead th { background:#eef5fc; color:#243247; }
html body .page .equity-table thead tr:first-child th { background:#e6f1fc; }
html body .page .equity-table .platform td { background:#f0f7ff; }
html body .page .equity-table tr.platform td { position:sticky; top:96px; z-index:2; background:#f0f7ff; box-shadow:0 2px 0 #bfc7d2; }
html body .page .equity-table .summary td { background:#f7faff; }
html body .page .cell-input:hover { border-color:#c6d7e9; }
html body .page .cell-input:focus { border-color:#55a4e6; box-shadow:0 0 0 2px #1976d222; }
html body .page .equity-table .percent-editor { display:flex; flex-wrap:nowrap; align-items:center; gap:4px; width:100%; white-space:nowrap; }
html body .page .equity-table .percent-editor .cell-input { flex:1 1 auto; width:auto; min-width:0; }
html body .page .equity-table .percent-editor .unit { flex:0 0 auto; display:inline-block; color:#667085; font-weight:650; line-height:1; user-select:none; white-space:nowrap; }
html body .page .equity-table td.numeric:has(> input[data-kind="percent"]) { position:relative; padding-right:28px; }
html body .page .equity-table td.numeric:has(> input[data-kind="percent"])::after { content:"%"; position:absolute; right:9px; top:50%; transform:translateY(-50%); color:#667085; pointer-events:none; font-weight:600; }
html body .page .equity-table td.numeric:has(> input[data-kind="percent"]) .cell-input { padding-right:2px; }

@media (max-width: 640px) {
  body { font-size: 14px; overflow-x: hidden; }
  button, .btn, .tab, input, select, textarea { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  .topbar, .topbar-row { gap: 8px; }
  .topbar .actions { gap: 6px; }
  .topbar .actions .btn, .actions .btn { flex: 1 1 auto; }
  .content, .main { padding-left: 12px; padding-right: 12px; }
  .stats, .cards, .grid2, .grid-2 { grid-template-columns: 1fr; }
  .modal-mask, .sheet, .wheel-mask { padding: 10px; }
  .modal, .sheet-box, .wheel-box { max-width: 100%; max-height: calc(100dvh - 20px); }
  table { font-size: 12px; }
  th, td { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Workspace module pages: hide chrome duplicated by outer shell */
html.embed .ws-embed-hide { display: none !important; }
html.embed .topbar .actions a.btn[href="/"],
html.embed .topbar .actions a.btn[href="/notify"],
html.embed .topbar .actions a.btn[href="/sandbox"],
html.embed .topbar .actions a.btn[href^="/audit"],
html.embed .topbar .actions a[href="/logout"],
html.embed .topbar .actions .account-name,
html.embed .topbar .actions button[onclick*="logout"],
html.embed .more-menu a[href="/sandbox"],
html.embed .more-menu a[href="/notify"],
html.embed header a.back[href="/"],
html.embed .actions a.btn[href="/"],
html.embed .actions a[href="/logout"],
html.embed .actions .account-name,
html.embed .actions button[onclick*="logout"] { display: none !important; }

/* A direct WeCom/deep link has no parent workspace. Keep its navigation visible. */
#workspaceStandaloneNav{--wsp-height:48px;position:sticky;top:0;z-index:20;flex:none;color:#263e58;background:#fff;border-bottom:1px solid #dce6f0;font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif}
#workspaceStandaloneNav *{box-sizing:border-box}
#workspaceStandaloneNav [hidden]{display:none!important}
#workspaceStandaloneNav .wsp-toolbar{display:flex;align-items:center;gap:12px;min-height:48px;padding:max(4px,env(safe-area-inset-top)) 12px 4px}
#workspaceStandaloneNav .wsp-home{color:#1976d2;font-size:13px;text-decoration:none;white-space:nowrap;min-height:40px;display:flex;align-items:center}
#workspaceStandaloneNav .wsp-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;font-size:14px}
#workspaceStandaloneNav button{font:14px/1.3 inherit;cursor:pointer;min-height:40px;border:1px solid #dae5f1;border-radius:7px;padding:8px 12px;color:#315a84;background:#edf5ff;white-space:nowrap;flex:none;width:auto;margin:0}
#workspaceStandaloneNav.wsp-open{z-index:10000}
#workspaceStandaloneNav .wsp-backdrop{position:fixed;inset:var(--wsp-height) 0 0;background:#142a4059}
#workspaceStandaloneNav .wsp-panel{position:fixed;top:var(--wsp-height);bottom:0;right:0;width:min(360px,100vw);overflow-y:auto;overscroll-behavior:contain;background:#fff;border-left:1px solid #dce5f0;box-shadow:-8px 8px 30px #1b30451a;padding:14px 16px max(24px,env(safe-area-inset-bottom))}
#workspaceStandaloneNav .wsp-panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
#workspaceStandaloneNav .wsp-close{font-size:23px;border:0;background:transparent;min-width:44px}
#workspaceStandaloneNav .wsp-group{border-top:1px solid #e8eef5;padding:10px 0}
#workspaceStandaloneNav h3{margin:0 0 4px;font-size:16px;font-weight:650;color:#263f5d}
#workspaceStandaloneNav .wsp-links a{display:flex;align-items:center;min-height:44px;padding:10px 12px;color:#4c6380;font-size:14px;text-decoration:none;border-radius:6px}
#workspaceStandaloneNav .wsp-links a:hover{background:#edf5ff;color:#1976d2}
@media(max-width:640px){#workspaceStandaloneNav .wsp-toolbar{gap:8px}#workspaceStandaloneNav .wsp-home,#workspaceStandaloneNav button{min-height:44px}.has-standalone-nav #app{min-height:calc(100dvh - 53px)}}
