/* Shared visual contract for portal, schedule, files, Study, Reader and Canvas. */
:root, html[data-theme="dark"], html[data-calendar-theme="dark"] {
  --ws-bg:#101420; --ws-panel:#181e2d; --ws-raised:#20283a; --ws-text:#edf1fa;
  --ws-muted:#9aa8c0; --ws-line:#303a50; --ws-accent:#9699ff; --ws-cyan:#6bd3de;
  --ws-shadow:0 16px 40px #03071333; --ws-radius:16px;
}
html[data-theme="light"], html[data-calendar-theme="light"] {
  --ws-bg:#f4f6fb; --ws-panel:#fff; --ws-raised:#edf1f8; --ws-text:#20283b;
  --ws-muted:#5f6e87; --ws-line:#dce2ef; --ws-accent:#555bd7; --ws-cyan:#087f91;
  --ws-shadow:0 12px 32px #2632570c;
}
html[data-theme],html[data-calendar-theme] {
  color-scheme:dark;
  --page:var(--ws-bg); --surface-soft:var(--ws-raised); --ink:var(--ws-text); --line-strong:var(--ws-line);
  --topbar:var(--ws-panel); --board-header:var(--ws-panel); --board-header-sticky:var(--ws-panel);
  --week-label:var(--ws-panel); --weekend:var(--ws-bg); --brand-ink:var(--ws-text); --control-ink:var(--ws-text);
  --text-strong:var(--ws-text); --event-ink:var(--ws-text); --event-meta:var(--ws-muted); --detail-ink:var(--ws-text);
  --bg:var(--ws-bg); --surface:var(--ws-panel); --surface-2:var(--ws-raised);
  --text:var(--ws-text); --muted:var(--ws-muted); --ink-soft:var(--ws-muted); --ink-faint:var(--ws-muted);
  --line:var(--ws-line); --border:var(--ws-line); --accent:var(--ws-accent); --accent-2:var(--ws-cyan);
  --accent-soft:color-mix(in srgb,var(--ws-accent) 12%,transparent); --radius:var(--ws-radius);
}
html[data-theme="light"] { color-scheme:light; }
html body { background:var(--ws-bg); color:var(--ws-text); font-family:Inter,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; }
body button,body input,body select,body textarea { font:inherit; }
body button,body a { -webkit-tap-highlight-color:transparent; }
body button { cursor:pointer; }
body button:disabled { cursor:default; opacity:.5; }
body :focus-visible { outline:2px solid var(--ws-cyan); outline-offset:3px; }
.workspace-nav { position:sticky; top:0; z-index:80; display:flex; gap:24px; align-items:center; padding:12px max(24px,calc((100vw - 1360px)/2)); background:var(--ws-bg); border-bottom:1px solid var(--ws-line); min-height:72px; }
.workspace-wordmark { font-size:23px; font-weight:760; letter-spacing:-1px; text-decoration:none; white-space:nowrap; color:var(--ws-text); }
.workspace-wordmark span { color:var(--ws-accent); }
.workspace-wordmark small { display:block; font-size:10px; font-weight:500; letter-spacing:1px; color:var(--ws-muted); }
.workspace-nav-links { display:flex; gap:4px; flex:1; overflow-x:auto; scrollbar-width:none; }
.workspace-nav-links a { padding:9px 12px; white-space:nowrap; text-decoration:none; color:var(--ws-muted); border-radius:10px; font-size:13px; }
.workspace-nav-links a:hover,.workspace-nav-links a[aria-current="page"] { color:var(--ws-text); background:var(--ws-raised); }
.workspace-nav-links a[aria-current="page"] { box-shadow:inset 0 -2px var(--ws-accent); }
.workspace-theme { border:1px solid var(--ws-line); border-radius:10px; background:var(--ws-panel); color:var(--ws-text); min-height:36px; min-width:36px; }
.workspace-unified .site-header { display:none; }
html body .study-shell { max-width:1280px; padding:28px 24px 64px; }
html body .study-topbar { position:static; top:auto; background:transparent; padding:0 0 18px; margin-bottom:24px; border-color:var(--ws-line); }
.study-topbar .study-top-actions { display:none; }
html body .study-panel,html body .subject-card,html body .metric-card,html body .subject-hero-panel,html body .today-hero-card,html body .cal-toolbar-card,html body .canvas-card,html body .canvas-library-hero,html body .canvas-create-card { background:var(--ws-panel); border:1px solid var(--ws-line); border-radius:var(--ws-radius); box-shadow:none; }
html body .study-panel { padding:24px; }
html body .subject-card:hover,html body .canvas-card:hover { border-color:var(--ws-accent); transform:translateY(-2px); }
html body .subject-hero-panel { background:linear-gradient(120deg,color-mix(in srgb,var(--ws-accent) 9%,var(--ws-panel)),var(--ws-panel)); }
html body .primary-action,html body .study-op.emphasis { background:var(--ws-accent); color:var(--ws-bg); border:1px solid transparent; border-radius:10px; }
html body .secondary-action,html body .study-op,html body .files-op { background:var(--ws-raised); color:var(--ws-text); border:1px solid var(--ws-line); border-radius:10px; }
html body .study-doc { background:transparent; border-color:var(--ws-line); }
html body .study-doc-name { color:var(--ws-text); overflow-wrap:anywhere; }
html body .study-error { color:#f18da5; border:1px solid #f18da544; background:#f18da50b; border-radius:10px; padding:12px; }
.study-warning { color:var(--ws-cyan); padding:12px; border:1px solid var(--ws-line); border-radius:10px; }
.study-muted { color:var(--ws-muted); font-size:13px; }
html body .files-frame { max-width:1280px; background:transparent; }
html body .files-topbar { background:transparent; border-color:var(--ws-line); }
html body .files-list,html body .files-row,html body .files-group { background:var(--ws-panel); border-color:var(--ws-line); color:var(--ws-text); }
html body .files-op.primary { background:var(--ws-accent); color:var(--ws-bg); }
.focus-panel { padding:24px; background:var(--ws-panel); border:1px solid var(--ws-line); border-radius:var(--ws-radius); margin-bottom:24px; }
.focus-tools,.focus-filters,.focus-task-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.focus-filters { justify-content:space-between; margin:18px 0 24px; }
.focus-panel select,.focus-panel input,.workspace-modal input,.workspace-modal textarea,.workspace-modal select { color:var(--ws-text); background:var(--ws-bg); border:1px solid var(--ws-line); border-radius:8px; padding:9px 10px; max-width:100%; }
.focus-board { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:20px; }
.focus-column { min-width:0; }
.focus-column h3 { font-size:14px; color:var(--ws-muted); display:flex; justify-content:space-between; }
.focus-task { padding:18px; background:var(--ws-bg); border:1px solid var(--ws-line); border-radius:12px; margin:12px 0; }
.focus-task h4 { font-size:16px; line-height:1.5; margin:10px 0; }
.focus-task p { color:var(--ws-muted); font-size:13px; white-space:pre-wrap; }
.focus-subject { font-size:11px; color:var(--ws-cyan); }
.focus-date { font-size:12px; color:var(--ws-muted); }
.focus-task-actions { margin-top:18px; }
.focus-task-actions select { font-size:12px; }
.focus-summary { display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:12px; }
.focus-summary-row { display:flex; gap:12px; align-items:center; background:var(--ws-bg); padding:14px; border-radius:10px; text-decoration:none; color:var(--ws-text); }
.focus-summary-row>span:nth-child(2) { flex:1; min-width:0; }
.focus-summary-row strong { font-weight:600; font-size:13px; }
.focus-summary-row small { display:block; color:var(--ws-muted); font-size:11px; margin-top:4px; }
.focus-dot { width:7px; height:7px; border-radius:50%; background:var(--ws-accent); flex-shrink:0; }
.workspace-modal-backdrop { position:fixed; inset:0; z-index:120; background:#060912aa; display:grid; place-items:center; padding:20px; }
.workspace-modal { width:min(540px,100%); max-height:90dvh; overflow:auto; background:var(--ws-panel); border:1px solid var(--ws-line); border-radius:18px; padding:28px; }
.workspace-modal label { display:grid; gap:6px; margin:14px 0; font-size:13px; }
.document-header { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:24px; }
.document-header h1 { font-size:22px; overflow-wrap:anywhere; }
.document-image,.document-media { display:block; max-width:100%; max-height:75dvh; margin:0 auto; border-radius:12px; }
.document-prose { max-width:880px; margin:auto; padding:32px; background:var(--ws-panel); border:1px solid var(--ws-line); border-radius:16px; line-height:1.9; overflow-wrap:anywhere; }
.document-prose .md-h1 { font-size:28px; }.document-prose .md-h2 { font-size:22px; }.document-prose .md-h3 { font-size:18px; }
.document-prose pre { margin:0; background:var(--ws-bg); padding:2px 14px; white-space:pre-wrap; }
.document-code { padding:24px; background:var(--ws-panel); border:1px solid var(--ws-line); border-radius:16px; white-space:pre-wrap; overflow-wrap:anywhere; font:13px/1.8 Consolas,monospace; }
.document-word { width:100%; height:78dvh; border:0; border-radius:12px; background:white; }
.slide-controls { display:flex; gap:18px; align-items:center; justify-content:center; margin-bottom:18px; }.slide-controls button { padding:10px; }
.slide-stage { position:relative; width:100%; background:white; color:#172033; overflow:hidden; container-type:inline-size; border-radius:12px; }
.slide-shape { position:absolute; white-space:pre-wrap; overflow:hidden; font-size:clamp(10px,2cqw,28px); }
.slide-shape img { width:100%; height:100%; object-fit:contain; }
html body .cyx-reader { background:var(--ws-bg); color:var(--ws-text); min-height:0; height:calc(100dvh - 77px); }
html body .cyx-reader-bar { background:var(--ws-panel); border-color:var(--ws-line); }
html body .cyx-rb-link,html body .cyx-rb-title { color:var(--ws-text); }
html body .cyx-reader-nav button,html body .cyx-reader-right button,html body .cyx-page-input,html body .cyx-search-input { color:var(--ws-text); background:var(--ws-raised); border-color:var(--ws-line); }
html body .cyx-rb,html body .cyx-reader-toolbar,html body .cyx-outline,html body .cyx-ann-sidebar { background:var(--ws-panel); color:var(--ws-text); border-color:var(--ws-line); }
html body .cyx-board-shell { height:calc(100dvh - 77px); min-height:0; background:var(--ws-bg); }
html body .cyx-board-bar { background:var(--ws-panel); border-color:var(--ws-line); padding:14px 20px; }
html body .cyx-board-title { color:var(--ws-text); background:transparent; }
html body .cyx-board-wrap { min-height:0; background:var(--ws-bg); }
.canvas-flow-region { position:absolute; inset:0; }
.canvas-flow-region.has-palette { left:260px; }
html body .cyx-cn { width:260px; background:var(--ws-panel); color:var(--ws-text); border-radius:14px; border-width:1px; box-shadow:var(--ws-shadow); }
html body .cyx-cn-selected { box-shadow:0 0 0 2px var(--ws-accent),var(--ws-shadow); }
html body .cyx-cn-body,html body .cyx-cn-source { color:var(--ws-muted); }
html body .cyx-inspector { color:var(--ws-text); background:var(--ws-panel); border:1px solid var(--ws-line); border-radius:14px; padding:20px; }
html body .cyx-inspector input,html body .cyx-inspector textarea,html body .cyx-inspector select { color:var(--ws-text); background:var(--ws-bg); border-color:var(--ws-line); }
.canvas-palette { position:absolute; left:20px; top:20px; width:220px; z-index:6; padding:16px; border:1px solid var(--ws-line); border-radius:14px; background:var(--ws-panel); box-shadow:var(--ws-shadow); max-height:70%; overflow:auto; }
.canvas-palette h3 { font-size:13px; margin:0 0 12px; }.canvas-palette button { display:block; width:100%; text-align:left; border:0; border-radius:8px; background:var(--ws-raised); color:var(--ws-text); padding:10px; margin:6px 0; }
.canvas-palette small { color:var(--ws-muted); font-size:11px; }.canvas-palette input { width:100%; padding:10px; background:var(--ws-bg); border:1px solid var(--ws-line); border-radius:8px; color:var(--ws-text); }
.canvas-hint { position:absolute; bottom:22px; left:50%; transform:translateX(-50%); z-index:5; padding:10px 16px; background:var(--ws-panel); border:1px solid var(--ws-line); border-radius:10px; color:var(--ws-muted); font-size:12px; max-width:70%; }
.canvas-close-inspector { float:right; background:transparent; border:0; color:var(--ws-muted); padding:4px; }
.canvas-save-status { font-size:12px; color:var(--ws-cyan); white-space:nowrap; }
.canvas-empty-guide { position:absolute; top:42%; left:50%; transform:translate(-30%,-50%); max-width:320px; pointer-events:none; color:var(--ws-muted); }.canvas-empty-guide h2 { color:var(--ws-text); }
html body .react-flow__handle { width:12px; height:12px; background:var(--ws-accent); border:2px solid var(--ws-panel); }
html body .react-flow__controls button { background:var(--ws-panel); color:var(--ws-text); fill:var(--ws-text); border-color:var(--ws-line); }
@media(max-width:900px) {
  .workspace-nav { gap:12px; padding:10px 16px; flex-wrap:wrap; }.workspace-wordmark { font-size:20px; }.workspace-wordmark small { display:none; }.workspace-nav-links { order:3; flex-basis:100%; }.workspace-theme { margin-left:auto; }
  html body .cyx-board-shell,html body .cyx-reader { height:calc(100dvh - 104px); }.canvas-palette { width:180px; left:10px; top:10px; }.canvas-flow-region.has-palette { left:0; }
  .workspace-nav-links a { padding:7px 10px; }.focus-board { grid-template-columns:1fr 1fr; }
}
@media(max-width:600px) {
  html body .react-flow__minimap { width:120px; height:80px; }
  html body .react-flow__minimap svg { width:120px; height:80px; }
  html body .study-shell { padding:20px 14px 48px; }.focus-panel,html body .study-panel { padding:18px; }.focus-board { grid-template-columns:1fr; }
  .document-header { flex-wrap:wrap; }.document-prose { padding:20px; }.workspace-modal { padding:20px; }
  .canvas-palette { width:150px; max-height:48%; padding:10px; }.canvas-palette button { font-size:12px; padding:8px; }.canvas-hint { display:none; }
  html body .cyx-inspector-wrap { left:10px; right:10px; top:auto; bottom:10px; width:auto; max-height:52%; overflow:auto; }.cyx-board-tools { overflow-x:auto; flex-wrap:nowrap!important; max-width:100%; }.cyx-board-tools button { flex-shrink:0; }
}

.document-prose a { color:var(--ws-cyan); }.document-prose table { border-collapse:collapse; display:block; overflow:auto; }.document-prose th,.document-prose td { padding:10px; border:1px solid var(--ws-line); }.document-prose blockquote { border-left:3px solid var(--ws-accent); margin:18px 0; padding:4px 18px; color:var(--ws-muted); }

.focus-single { display:block; }.focus-single .focus-column { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:16px; }.focus-single .focus-column h3 { grid-column:1/-1; }.focus-single .focus-task { margin:0; }

html body .subject-card::before { display:none; }
html body .cyx-cn-source { border-left:0; padding-left:0; }
.transaction-modes { display:flex; flex-wrap:wrap; gap:8px; max-width:1232px; margin:20px auto 0; padding:0 24px; }
.transaction-modes a { padding:10px 16px; border-radius:12px; background:var(--ws-panel); color:var(--ws-muted); text-decoration:none; border:1px solid var(--ws-line); }
.transaction-modes a[aria-current="page"] { color:var(--ws-text); background:var(--ws-raised); border-color:var(--ws-accent); }

.course-view-only .project-section,.course-view-only .daily-section,.course-view-only .plan-filter-section,.course-view-only .data-section,.course-view-only #tomorrowCard { display:none; }
.workspace-schedule-links a { display:block; padding:10px 0; color:var(--ws-accent); text-decoration:none; }
.workspace-schedule-links p { color:var(--ws-muted); font-size:13px; line-height:1.7; }

html body .study-topbar { box-shadow:none; border-radius:0; }
