:root{
  --bg:#090b10;--panel:#0f1219;--panel2:#141822;--panel3:#191e29;--line:#262d3a;--border-color:#262d3a;--bg-main:#141822;--text:#edf2f7;--muted:#8e99aa;--accent:#7c5cff;--accent2:#9b87ff;--primary:#7c5cff;--surface:#141822;--green:#35d07f;--yellow:#f3c969;--red:#ff6b7a;--shadow:0 20px 60px rgba(0,0,0,.28);--radius:14px;--editor-font:16px;--editor-line:1.62
}
body.light{--bg:#eef2f7;--panel:#fff;--panel2:#f7f9fc;--panel3:#eef2f7;--line:#dce2ea;--border-color:#dce2ea;--bg-main:#fff;--text:#171c26;--muted:#6f7b8b;--primary:#6846ec;--surface:#e2e8f0;--shadow:0 18px 50px rgba(50,63,85,.12)}
*{box-sizing:border-box}html,body{min-height:100%}html{overflow-x:hidden;max-width:100vw}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;overflow-x:hidden;overflow-y:auto;max-width:100vw}button,select,textarea{font:inherit}button{color:inherit}.hidden{display:none!important}
.app-shell{min-height:100vh;display:flex;flex-direction:column;max-width:100vw;overflow-x:hidden}.topbar{height:58px;min-height:58px;max-height:58px;background:var(--panel);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 14px;gap:12px;z-index:50;position:sticky;top:0}
.brand-zone,.top-actions,.context-actions,.title-row,.pane-toolbar,.editor-actions,.output-actions,.device-controls,.console-filters,.modal-head{display:flex;align-items:center}.brand-zone{gap:10px;flex-shrink:0}.brand-mark{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:linear-gradient(135deg,var(--accent),#4d9bff);color:white;font-weight:900;font-size:13px;box-shadow:0 8px 24px rgba(124,92,255,.25)}.brand-copy{display:grid;line-height:1.05}.brand-copy strong{font-size:15px}.brand-copy small{font-size:11px;color:var(--muted);margin-top:4px}.top-actions{gap:7px;flex-shrink:0}.runtime-pill{height:30px;padding:0 10px;border:1px solid var(--line);border-radius:999px;display:flex;align-items:center;gap:7px;color:var(--muted);font-size:12px;white-space:nowrap;flex-shrink:0}.runtime-pill i,.output-dot{width:7px;height:7px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px rgba(53,208,127,.08)}.runtime-pill.running i{background:var(--yellow);animation:pulse 1s infinite}.runtime-pill.error i{background:var(--red)}
button{border:0;background:none;cursor:pointer}.icon-btn,.mini-btn,.ghost-btn,.primary-btn,.danger-btn{height:34px;border-radius:9px;display:inline-flex;align-items:center;justify-content:center;gap:7px;transition:.16s;white-space:nowrap;flex-shrink:0}.icon-btn,.mini-btn{width:34px;border:1px solid var(--line);background:var(--panel2)}.ghost-btn{padding:0 11px;border:1px solid var(--line);background:var(--panel2)}.primary-btn{padding:0 14px;background:var(--accent);color:white;font-weight:750}.primary-btn:hover{background:var(--accent2)}.danger-btn{padding:0 12px;background:rgba(255,107,122,.14);color:var(--red);border:1px solid rgba(255,107,122,.3);font-weight:700}.wide{width:100%;height:42px}.icon-btn:hover,.mini-btn:hover,.ghost-btn:hover{border-color:#4a5568;background:var(--panel3)}kbd{font-size:10px;padding:2px 5px;border:1px solid rgba(255,255,255,.14);border-radius:5px;background:rgba(0,0,0,.13)}body.light kbd{border-color:var(--line)}
.workspace{min-height:0;display:grid;grid-template-columns:232px 1fr}.sidebar{min-height:0;background:var(--panel);border-right:1px solid var(--line);padding:14px 10px;display:flex;flex-direction:column;gap:18px;overflow:auto}.sidebar-section{display:grid;gap:6px}.section-label{margin:2px 10px 7px;font-size:10px;font-weight:800;letter-spacing:.14em;color:var(--muted)}.tool-item{width:100%;padding:9px;border-radius:10px;display:flex;align-items:center;gap:10px;text-align:left}.tool-item:hover,.tool-item.active{background:var(--panel3)}.tool-item.active{box-shadow:inset 3px 0 0 var(--accent)}.tool-item span:last-child{display:grid;min-width:0}.tool-item b{font-size:13px}.tool-item small{font-size:11px;color:var(--muted);margin-top:2px}.tool-badge{width:34px;height:30px;border-radius:8px;background:#22283a;display:grid;place-items:center;font-weight:900;font-size:9px;color:#a8b5c8}.tool-badge.js{color:#f2d75f}.tool-badge.py{color:#7ab7ff}.tool-badge.sql{color:#74e4c0}.tool-badge.md{color:#d1b8ff}.side-action{height:34px;padding:0 10px;text-align:left;border-radius:9px;color:var(--muted);font-size:12px}.side-action:hover{background:var(--panel3);color:var(--text)}.sidebar-footer{margin-top:auto;display:grid;gap:10px}.security-card{padding:10px;border-radius:12px;border:1px solid var(--line);background:var(--panel2);display:flex;gap:9px;align-items:center}.security-icon{width:28px;height:28px;display:grid;place-items:center;border-radius:50%;background:rgba(53,208,127,.1);color:var(--green);font-weight:800}.security-card div:last-child{display:grid}.security-card b{font-size:11px}.security-card small{font-size:10px;color:var(--muted);margin-top:2px}.text-link{color:var(--muted);font-size:11px;padding:4px 8px;min-height:24px;display:inline-flex;align-items:center}.text-link:hover{color:var(--text)}
.main-panel{min-width:0;min-height:0;display:grid;grid-template-rows:auto 1fr}.contextbar{min-height:70px;padding:10px 14px;border-bottom:1px solid var(--line);background:var(--bg);display:flex;align-items:center;justify-content:space-between;gap:12px}.context-copy h1{font-size:17px;margin:0}.context-copy p{font-size:11px;color:var(--muted);margin:5px 0 0}.title-row{gap:8px}.privacy-badge{font-size:9px;padding:3px 6px;border-radius:999px;background:rgba(53,208,127,.08);color:var(--green);border:1px solid rgba(53,208,127,.15)}.context-actions{gap:7px;flex-wrap:wrap;justify-content:flex-end}.toggle-wrap,.select-wrap{height:34px;padding:0 9px;border:1px solid var(--line);border-radius:9px;background:var(--panel2);display:flex;align-items:center;gap:8px;font-size:11px;color:var(--muted)}.toggle-wrap input{display:none}.toggle-wrap i{width:30px;height:17px;border-radius:999px;background:#394150;position:relative;transition:.18s}.toggle-wrap i:after{content:"";width:11px;height:11px;border-radius:50%;background:white;position:absolute;left:3px;top:3px;transition:.18s}.toggle-wrap input:checked+i{background:var(--accent)}.toggle-wrap input:checked+i:after{transform:translateX(13px)}.select-wrap select{border:0;background:transparent;color:var(--text);outline:none;font-size:11px}.select-wrap select option{background:var(--panel)}
.split-layout{min-height:0;padding:10px;display:grid;grid-template-columns:minmax(320px,1fr) 7px minmax(320px,1fr)}.pane{min-width:0;min-height:0;background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;display:grid;box-shadow:0 3px 10px rgba(0,0,0,.04)}.editor-pane{grid-template-rows:42px 1fr 28px}.output-pane{grid-template-rows:42px 1fr 28px}.resize-handle{cursor:col-resize;position:relative}.resize-handle:after{content:"";position:absolute;left:3px;top:46%;height:30px;width:2px;border-radius:3px;background:var(--line)}.pane-toolbar{height:42px;padding:0 9px;border-bottom:1px solid var(--line);justify-content:space-between;gap:8px}.tabs{height:100%;display:flex}.tab{height:100%;padding:0 13px;font-size:11px;color:var(--muted);position:relative}.tab.active{color:var(--text);font-weight:750}.tab.active:after{content:"";height:2px;position:absolute;bottom:0;left:8px;right:8px;background:var(--accent);border-radius:3px 3px 0 0}.editor-actions{gap:5px}.editor-actions .mini-btn{height:27px;width:29px;font-size:10px}.editor-actions span{font-size:10px;color:var(--muted);min-width:34px;text-align:center}
.editor-shell{min-height:0;display:flex;position:relative;background:#0b0e14;overflow:hidden}.editor-mount{width:100%;height:100%;display:flex;position:relative;overflow:hidden}.fallback-editor{display:none!important}.statusbar,.output-footer{height:28px;padding:0 9px;display:flex;align-items:center;gap:12px;color:var(--muted);font-size:10px;border-top:1px solid var(--line);background:var(--panel2)}.push-right{margin-left:auto}
.output-title{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:700}.output-actions{gap:5px}.output-actions .mini-btn,.device-btn{height:27px;width:29px;border-radius:7px;border:1px solid var(--line);background:var(--panel2);font-size:12px}.device-controls{gap:4px}.device-btn.active{border-color:var(--accent);color:var(--accent2);background:rgba(124,92,255,.08)}.output-stage{min-height:0;position:relative;overflow:hidden;background:#0b0e14}.preview-wrap{height:100%;width:100%;display:flex;justify-content:center;overflow:auto;background:#20252e;padding:0}.preview-wrap iframe{height:100%;width:100%;border:0;background:white;transition:width .2s;box-shadow:0 0 0 1px rgba(255,255,255,.06)}.console-panel,.sql-panel,.markdown-panel{height:100%;overflow:auto}.console-panel{display:grid;grid-template-rows:36px 1fr auto;background:#0b0e14}.console-toolbar{padding:0 10px;border-bottom:1px solid #1d2330;display:flex;justify-content:space-between;align-items:center;color:#667085;font-size:10px}.console-filters{gap:5px;display:flex;flex-wrap:wrap}.filter-chip{padding:3px 8px;border-radius:999px;color:#788498;font-size:10px}.filter-chip.active{background:#1b2130;color:#d6deeb}.console-lines{padding:10px 0;overflow:auto}.console-line{padding:6px 12px;border-bottom:1px solid rgba(255,255,255,.035);display:grid;grid-template-columns:56px 1fr;gap:8px;font:12px/1.55 "SFMono-Regular",Consolas,monospace;color:#c7d1e0;white-space:pre-wrap;word-break:break-word}.console-line .badge{font-size:9px;text-transform:uppercase;color:#657083}.console-line.warn{color:#f3c969;background:rgba(243,201,105,.025)}.console-line.error{color:#ff8591;background:rgba(255,107,122,.035)}.console-line.result{color:#66dda0}.console-line.hidden-line{display:none}.sql-panel{padding:14px;color:#d8e1ef}.sql-result{margin-bottom:18px}.sql-result h3{font-size:11px;color:#8e99aa;margin:0 0 7px}.sql-table-wrap{overflow:auto;border:1px solid #263041;border-radius:9px}.sql-table{width:100%;border-collapse:collapse;font:11px/1.5 "SFMono-Regular",Consolas,monospace}.sql-table th,.sql-table td{padding:7px 9px;border-right:1px solid #222a37;border-bottom:1px solid #222a37;text-align:left;white-space:nowrap}.sql-table th{background:#151b25;color:#aab7ca;position:sticky;top:0}.sql-empty{padding:30px;text-align:center;color:#788498}.markdown-panel{background:#fff;color:#202733;padding:28px 34px;line-height:1.65}.markdown-panel h1,.markdown-panel h2,.markdown-panel h3{line-height:1.25}.markdown-panel pre{background:#111827;color:#e5e7eb;padding:14px;border-radius:9px;overflow:auto}.markdown-panel code{font-family:Consolas,monospace}.markdown-panel blockquote{border-left:3px solid #8b5cf6;padding-left:12px;color:#657083}.markdown-panel table{border-collapse:collapse}.markdown-panel th,.markdown-panel td{border:1px solid #dfe4eb;padding:6px 9px}.empty-state,.runtime-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;background:#0b0e14;color:#758195}.empty-state div{font-size:30px}.empty-state b,.runtime-overlay b{color:#b4becc;font-size:12px}.empty-state small,.runtime-overlay small{font-size:10px}.loader{width:24px;height:24px;border-radius:50%;border:2px solid #28303e;border-top-color:var(--accent);animation:spin .8s linear infinite}.output-footer span:nth-child(2){margin-left:auto}.output-footer .text-link{margin-left:4px}.danger-hover:hover{color:var(--red)}
.modal{width:min(520px,calc(100% - 24px));border:1px solid var(--line);border-radius:16px;background:var(--panel);color:var(--text);padding:0;box-shadow:var(--shadow)}.modal::backdrop{background:rgba(0,0,0,.62);backdrop-filter:blur(4px)}.modal-head{justify-content:space-between;padding:18px;border-bottom:1px solid var(--line)}.modal-head h2{font-size:16px;margin:0}.modal-head p{font-size:11px;color:var(--muted);margin:4px 0 0}.shortcut-grid{display:grid;grid-template-columns:1fr auto;gap:1px;background:var(--line)}.shortcut-grid>*{padding:10px 14px;background:var(--panel);font-size:11px}.offline-body{padding:18px}.offline-info{padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--panel2);margin-bottom:15px}.offline-info b{font-size:11px}.offline-info p{font-size:10px;color:var(--muted);line-height:1.55;margin:5px 0 0}.progress-track{height:7px;background:var(--panel3);border-radius:999px;overflow:hidden}.progress-track i{display:block;width:0;height:100%;background:linear-gradient(90deg,var(--accent),#4d9bff);transition:width .2s}.progress-label{font-size:10px;color:var(--muted);min-height:16px}.toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,10px);background:#1b202b;color:#eef2f7;border:1px solid #303849;border-radius:10px;padding:9px 13px;font-size:11px;opacity:0;pointer-events:none;transition:.18s;z-index:200}.toast.show{opacity:1;transform:translate(-50%,0)}.mobile-only{display:none}
body.presentation .sidebar,body.presentation .contextbar,body.presentation .statusbar,body.presentation .output-footer{display:none}body.presentation .workspace{grid-template-columns:1fr}body.presentation .main-panel{grid-template-rows:1fr}body.presentation .split-layout{padding:6px}body.presentation{--editor-font:22px}body.focus-mode .output-pane,body.focus-mode .resize-handle{display:none}body.focus-mode .split-layout{grid-template-columns:minmax(0,1fr)}body.focus-mode .editor-pane{width:100%;max-width:none;margin:0;height:100%}
@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.35}}
@media(max-width:980px){body{overflow-x:hidden;overflow-y:auto;max-width:100vw}.app-shell{height:auto;min-height:100vh;max-width:100vw}.workspace{display:block}.mobile-only{display:inline-flex}.sidebar{position:fixed;left:0;top:58px;bottom:0;width:240px;z-index:45;transform:translateX(-105%);transition:.2s;box-shadow:var(--shadow)}.sidebar.open{transform:translateX(0)}.main-panel{min-height:calc(100vh - 58px)}.contextbar{align-items:flex-start;flex-direction:column}.context-actions{width:100%;justify-content:flex-start}.split-layout{grid-template-columns:1fr;grid-template-rows:minmax(440px,55vh) minmax(420px,45vh);gap:10px}.resize-handle{display:none}.hide-medium{display:none!important}.hide-small{display:none!important}.pane{border-radius:12px}}
@media(max-width:620px){.topbar{padding:0 8px}.brand-copy small,.runtime-pill{display:none}.contextbar{padding:9px}.toggle-wrap span,.select-wrap span{display:none}.split-layout{padding:7px;grid-template-rows:60vh 55vh}.line-numbers{min-width:38px}.highlight-layer,#codeEditor{padding-left:11px}.tab{padding:0 9px}.markdown-panel{padding:20px}.device-controls{display:none}}

/* --- Upgraded Features Styles --- */
.update-banner {
  background: linear-gradient(90deg, #7c5cff, #4d9bff);
  color: white;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  z-index: 100;
}
.update-btn {
  background: white;
  color: #171c26;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 12px;
  height: 26px;
}
.network-pill {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}
.net-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.net-dot.offline {
  background: var(--yellow);
}
.file-count-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(124,92,255,0.2);
  color: var(--accent2);
  font-size: 10px;
  font-weight: 800;
  margin-left: 4px;
}
.sql-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.console-tool-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.console-line.info { color: #82aaff; }
.console-line.input { color: #f2d75f; background: rgba(242,215,95,0.04); }
.console-line.system { color: #a8b5c8; font-style: italic; }
.console-line.runtime { color: #c792ea; }
.console-input-zone {
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  background: var(--panel2);
}
.console-input-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.console-input-prompt {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12px;
  color: var(--accent2);
  font-weight: 600;
}
.console-input-form {
  display: flex;
  gap: 8px;
}
.console-input-box {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 13px;
  outline: none;
}
.console-input-box:focus {
  box-shadow: 0 0 0 2px rgba(124,92,255,0.3);
}
.console-input-btn {
  padding: 0 16px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
}
.console-media {
  margin: 10px 0;
  padding: 10px;
  background: #0d1117;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.console-media img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.media-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}
.mini-download-btn {
  padding: 4px 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.16s;
}
.mini-download-btn:hover {
  background: var(--panel3);
  border-color: var(--accent);
  color: var(--accent2);
}
.dataframe-table, .py-dataframe-table {
  width: 100%;
  border-collapse: collapse;
  font: 11px/1.5 'SFMono-Regular', Consolas, monospace;
  margin: 8px 0;
  border: 1px solid #263041;
  border-radius: 8px;
  overflow: hidden;
}
.dataframe-table th, .dataframe-table td,
.py-dataframe-table th, .py-dataframe-table td {
  padding: 6px 10px;
  border: 1px solid #222a37;
  text-align: left;
}
.dataframe-table th, .py-dataframe-table th {
  background: #151b25;
  color: #aab7ca;
}
.file-tray-modal {
  width: min(640px, calc(100% - 24px));
}
.file-tray-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 70vh;
  overflow: auto;
}
.file-tray-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.file-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 48px;
}
.empty-hint {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin: 6px 0;
}
.file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 9px;
  gap: 10px;
}
.file-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.file-icon {
  font-size: 18px;
}
.file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.file-info strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-info small {
  font-size: 10px;
  color: var(--muted);
}
.file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.sql-schema-drawer {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}
.schema-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.schema-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 240px;
  overflow: auto;
}
.schema-table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.schema-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.schema-table-head strong {
  font-size: 12px;
  color: var(--accent2);
}
.schema-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.schema-col-pill {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 10px;
  padding: 2px 7px;
  background: var(--panel3);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #c7d1e0;
}
.schema-col-pill b {
  color: var(--yellow);
}

/* --- CodeMirror 6 Editor & Autocomplete IntelliSense --- */
.editor-shell {
  min-height: 0;
  display: flex;
  position: relative;
  background: #0b0e14;
  overflow: hidden;
  cursor: text;
}
.editor-mount {
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  position: relative;
  overflow: hidden;
  cursor: text;
}

.cm-editor {
  width: 100%;
  height: 100%;
  min-height: 100%;
  font-family: var(--font-mono, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace);
  font-size: var(--editor-font, 16px);
  line-height: var(--editor-line, 1.62);
  outline: none !important;
  background: transparent;
  color: #edf2f7;
  cursor: text;
}
body.light .cm-editor {
  color: #171c26;
  background: #ffffff;
}
body.light .editor-shell {
  background: #ffffff;
}

.cm-editor .cm-scroller {
  font-family: inherit;
  line-height: inherit;
  overflow: auto;
  height: 100% !important;
  min-height: 100% !important;
  cursor: text;
}

.cm-editor .cm-content {
  min-height: 100% !important;
  padding: 14px 16px 60px 8px;
  caret-color: #ffffff;
  cursor: text;
  user-select: text !important;
  -webkit-user-select: text !important;
}
body.light .cm-editor .cm-content {
  caret-color: #171c26;
}

.cm-editor .cm-cursor {
  border-left: 2px solid #ffffff;
}
body.light .cm-editor .cm-cursor {
  border-left-color: #171c26;
}

.cm-editor .cm-gutters {
  background: #0d1017;
  color: #465064;
  border-right: 1px solid #181d27;
  user-select: none;
}
body.light .cm-editor .cm-gutters {
  background: #f7f9fc;
  color: #8e99aa;
  border-right-color: #dce2ea;
}

.cm-lineNumbers .cm-gutterElement {
  min-width: 40px;
  padding: 0 10px 0 6px;
  text-align: right;
  font-size: 12px;
}

.cm-foldGutter .cm-gutterElement {
  padding: 0 4px;
  cursor: pointer;
  color: #5d6b82;
  font-size: 12px;
}
.cm-foldGutter .cm-gutterElement:hover {
  color: var(--accent);
}

.cm-activeLine {
  background: rgba(255, 255, 255, 0.03) !important;
}
body.light .cm-activeLine {
  background: rgba(0, 0, 0, 0.035) !important;
}

.cm-activeLineGutter {
  background: rgba(124, 92, 255, 0.12) !important;
  color: var(--accent) !important;
}

.cm-selectionBackground,
.cm-editor ::selection {
  background: rgba(124, 92, 255, 0.32) !important;
}

.cm-matchingBracket,
.cm-nonmatchingBracket {
  background: rgba(124, 92, 255, 0.28) !important;
  outline: 1px solid var(--accent);
  border-radius: 2px;
  color: #ffffff !important;
}

/* Find/Replace Panel */
.cm-panels {
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
}
.cm-panels-bottom {
  border-top: 1px solid var(--line);
  border-bottom: none;
}
.cm-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}
.cm-search input {
  background: var(--panel3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 8px;
  font-size: 12px;
  outline: none;
}
.cm-search button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
}
.cm-search button:hover {
  border-color: var(--accent);
  background: var(--panel2);
}

/* IN-EDITOR AUTOCOMPLETE DROPDOWN (VS Code Inline Style) */
.cm-tooltip.cm-tooltip-autocomplete {
  background: #111520;
  border: 1px solid #283144;
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  padding: 5px;
  min-width: 260px;
  max-width: 480px;
  max-height: 280px;
  z-index: 99999;
}
body.light .cm-tooltip.cm-tooltip-autocomplete {
  background: #ffffff;
  border-color: #dce2ea;
  box-shadow: 0 16px 40px rgba(40, 50, 70, 0.16), 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cm-tooltip-autocomplete > ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  font-family: inherit;
}

.cm-tooltip-autocomplete > ul > li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  line-height: 1.35;
  transition: background 0.08s ease;
  user-select: none;
}

.cm-tooltip-autocomplete > ul > li:hover {
  background: rgba(255, 255, 255, 0.06);
}
body.light .cm-tooltip-autocomplete > ul > li:hover {
  background: rgba(0, 0, 0, 0.05);
}

.cm-tooltip-autocomplete > ul > li[aria-selected] {
  background: var(--accent) !important;
  color: #ffffff !important;
}

.cm-completionIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  font-family: inherit;
  flex-shrink: 0;
  text-transform: uppercase;
}

.cm-completionIcon-function,
.cm-completionIcon-method {
  background: rgba(130, 170, 255, 0.2);
  color: #82aaff;
}
.cm-completionIcon-variable,
.cm-completionIcon-property {
  background: rgba(247, 140, 108, 0.2);
  color: #f78c6c;
}
.cm-completionIcon-keyword {
  background: rgba(199, 146, 234, 0.2);
  color: #c792ea;
}
.cm-completionIcon-class,
.cm-completionIcon-type {
  background: rgba(255, 203, 107, 0.2);
  color: #ffcb6b;
}
.cm-completionIcon-tag {
  background: rgba(240, 113, 120, 0.2);
  color: #f07178;
}
.cm-completionIcon-text,
.cm-completionIcon-snippet {
  background: rgba(53, 208, 127, 0.2);
  color: #35d07f;
}

.cm-completionLabel {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
}

.cm-completionMatchedText {
  color: #74e4c0;
  font-weight: 800;
  text-decoration: none;
}
.cm-tooltip-autocomplete > ul > li[aria-selected] .cm-completionMatchedText {
  color: #ffffff;
  text-decoration: underline;
}

.cm-completionDetail {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  padding-left: 12px;
}
.cm-tooltip-autocomplete > ul > li[aria-selected] .cm-completionDetail {
  color: rgba(255, 255, 255, 0.85);
}

/* Hover Tooltip / Documentation Preview */
.cm-tooltip.cm-tooltip-hover {
  background: #111520;
  border: 1px solid #283144;
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 460px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  line-height: 1.5;
  color: #edf2f7;
  z-index: 100000;
}
body.light .cm-tooltip.cm-tooltip-hover {
  background: #ffffff;
  border-color: #dce2ea;
  color: #171c26;
  box-shadow: 0 12px 36px rgba(30, 40, 60, 0.15);
}
.cm-tooltip-hover pre {
  margin: 4px 0;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  font-size: 11px;
}

/* ========================================================
   v8.0.0 Cloud Projects, RBAC & Autosave UI
   ======================================================== */
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  height: 32px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.user-menu-btn:hover {
  border-color: #4a5568;
}
.user-role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  background: rgba(124, 92, 255, 0.15);
  color: var(--accent2);
}
.user-role-badge.admin {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}
.user-role-badge.instructor {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
.user-role-badge.student {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

/* Autosave indicator pill */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--muted);
  transition: all 0.2s ease;
}
.save-indicator i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.save-indicator.editing {
  color: var(--yellow);
}
.save-indicator.editing i {
  background: var(--yellow);
}
.save-indicator.saving {
  color: #93c5fd;
}
.save-indicator.saving i {
  background: #3b82f6;
  animation: pulse 0.8s infinite;
}
.save-indicator.saved {
  color: var(--green);
}
.save-indicator.saved i {
  background: var(--green);
}
.save-indicator.error {
  color: var(--red);
}
.save-indicator.error i {
  background: var(--red);
}
.save-indicator.offline {
  color: #f59e0b;
}
.save-indicator.offline i {
  background: #f59e0b;
}

/* Active Project Pill */
.project-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 32px;
  background: rgba(124, 92, 255, 0.08);
  border: 1px solid rgba(124, 92, 255, 0.25);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  max-width: 220px;
}
.project-pill:hover {
  background: rgba(124, 92, 255, 0.15);
}
.project-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dialog & Modal styling */
dialog.modal {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  width: min(520px, calc(100vw - 28px));
  max-height: 90vh;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  margin: auto;
  overflow: hidden;
}

dialog.modal:not([open]) {
  display: none !important;
}

dialog.modal[open] {
  display: flex !important;
  flex-direction: column;
}

dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  flex-shrink: 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.modal-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.modal-content {
  padding: 18px 20px;
  box-sizing: border-box;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Project Dialogs */
.project-modal {
  width: min(760px, calc(100vw - 28px)) !important;
}

@media (max-width: 640px) {
  dialog.modal {
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: 88vh !important;
    border-radius: 14px;
    z-index: 10000;
  }
  .modal-head {
    padding: 14px 16px 12px;
  }
  .modal-content {
    padding: 14px 16px;
  }
  .modal-form-row label {
    font-size: 12px;
  }
  .modal-form-input {
    font-size: 14px;
    padding: 10px 12px;
  }
  .project-list-table th,
  .project-list-table td {
    padding: 8px 6px;
    font-size: 11px;
  }
}
.project-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 10px;
}
.project-list-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.project-list-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.project-list-table tr:hover td {
  background: var(--panel3);
}
.modal-form-row {
  margin-bottom: 14px;
}
.modal-form-row label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
}
.modal-form-input {
  width: 100%;
  padding: 8px 11px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  box-sizing: border-box;
}
.modal-form-input:focus {
  outline: none;
  border-color: var(--accent);
}
.version-card {
  padding: 10px 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.version-card:hover {
  border-color: #4a5568;
}

/* ========================================================
   Full Light Theme Overrides
   ======================================================== */
body.light .editor-shell {
  background: #ffffff;
}
body.light .output-stage {
  background: #ffffff;
}
body.light .console-panel {
  background: #ffffff;
}
body.light .console-toolbar {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
body.light .console-lines {
  background: #ffffff;
}
body.light .console-line {
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
}
body.light .console-line .badge {
  color: #64748b;
}
body.light .console-line.info {
  color: #2563eb;
}
body.light .console-line.warn {
  color: #b45309;
  background: rgba(245, 158, 11, 0.08);
}
body.light .console-line.error {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.06);
}
body.light .console-line.result {
  color: #059669;
}
body.light .console-line.input {
  color: #92400e;
  background: rgba(245, 158, 11, 0.08);
}
body.light .console-line.system {
  color: #64748b;
}
body.light .console-line.runtime {
  color: #7c3aed;
}

body.light .filter-chip {
  background: #f1f5f9;
  color: #64748b;
}
body.light .filter-chip.active {
  background: #e0e7ff;
  color: #4338ca;
}

body.light .sql-panel {
  background: #ffffff;
  color: #1e293b;
}
body.light .sql-result h3 {
  color: #64748b;
}
body.light .sql-table-wrap {
  border: 1px solid #e2e8f0;
  background: #ffffff;
}
body.light .sql-table th {
  background: #f8fafc;
  color: #334155;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}
body.light .sql-table td {
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}
body.light .sql-table tr:hover td {
  background: #f8fafc;
}
body.light .sql-empty {
  color: #64748b;
}

body.light .tool-badge {
  background: #e2e8f0;
  color: #475569;
}
body.light .tool-badge.js {
  background: #fef3c7;
  color: #92400e;
}
body.light .tool-badge.py {
  background: #dbeafe;
  color: #1d4ed8;
}
body.light .tool-badge.sql {
  background: #ccfbf1;
  color: #0f766e;
}
body.light .tool-badge.md {
  background: #ede9fe;
  color: #6d28d9;
}

body.light .preview-wrap {
  background: #f1f5f9;
}

body.light .empty-state,
body.light .runtime-overlay {
  background: #ffffff;
  color: #64748b;
}
body.light .empty-state b,
body.light .runtime-overlay b {
  color: #0f172a;
}
body.light .loader {
  border-color: #e2e8f0;
  border-top-color: var(--accent);
}

body.light .console-input-zone {
  background: #f8fafc;
  border-top: 1px solid var(--line);
}
body.light .console-input-prompt {
  color: var(--accent);
}
body.light .console-input-field {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}
body.light .console-input-field:focus {
  border-color: var(--accent);
}

body.light .sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
}
body.light .tool-item:hover,
body.light .tool-item.active {
  background: #f1f5f9;
}
body.light .tool-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}
body.light .tool-item b {
  color: #0f172a;
}
body.light .side-action:hover {
  background: #f1f5f9;
  color: var(--text);
}
body.light .security-card {
  background: #f8fafc;
  border: 1px solid var(--line);
}

body.light .icon-btn,
body.light .mini-btn,
body.light .ghost-btn {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
}
body.light .icon-btn:hover,
body.light .mini-btn:hover,
body.light .ghost-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

body.light .runtime-pill,
body.light .network-pill,
body.light .toggle-wrap,
body.light .select-wrap {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--muted);
}
body.light .select-wrap select {
  color: var(--text);
}
body.light .select-wrap select option {
  background: #ffffff;
  color: var(--text);
}

body.light .project-pill,
body.light .user-menu-btn {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
}
body.light .user-menu-btn:hover,
body.light .project-pill:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

body.light .toast {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
body.light .modal {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
body.light .modal-head {
  border-bottom: 1px solid var(--line);
}
body.light .shortcut-grid {
  background: var(--line);
}
body.light .shortcut-grid > * {
  background: #ffffff;
  color: var(--text);
}
body.light .offline-info {
  background: #f8fafc;
  border: 1px solid var(--line);
}
body.light .progress-track {
  background: #e2e8f0;
}
body.light .modal-form-input {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}
body.light .version-card {
  background: #f8fafc;
  border: 1px solid var(--line);
}
body.light .version-card:hover {
  border-color: #cbd5e1;
}

body.light .user-role-badge.admin {
  background: rgba(168, 85, 247, 0.15);
  color: #7e22ce;
}
body.light .user-role-badge.instructor {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
}
body.light .user-role-badge.student {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}
body.light .user-role-badge.guest {
  background: rgba(100, 116, 139, 0.15);
  color: #334155;
}

/* ==========================================================================
   V8.3.0 DESIGN SYSTEM: NAVBAR, DASHBOARD, EXAMPLES, CMS & SAAS FOOTER
   ========================================================================== */

/* Announcement Bar */
.announcement-bar {
  background: linear-gradient(90deg, #6366f1, #3b82f6);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  z-index: 1000;
}
.announcement-icon {
  font-size: 14px;
}
.announcement-close {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  position: absolute;
  right: 14px;
}
.announcement-close:hover {
  color: #ffffff;
}

/* Header Navigation Links */
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  flex-shrink: 0;
}
.nav-link {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.nav-link.active {
  color: #ffffff !important;
  background: var(--accent) !important;
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.35);
}
body.light .nav-link {
  color: #4b5563;
}
body.light .nav-link:hover {
  color: #111827;
  background: #e2e8f0;
}
body.light .nav-link.active {
  color: #ffffff !important;
  background: #6846ec !important;
  box-shadow: 0 2px 8px rgba(104, 70, 236, 0.35);
}

/* Playground Topbar Controls */
.playground-top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
.playground-top-controls.hidden {
  display: none !important;
}
.project-pill {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.project-pill:hover {
  border-color: var(--accent);
  background: var(--panel3);
}
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  padding: 0 4px;
  white-space: nowrap;
}
.save-indicator i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}
.save-indicator.dirty i {
  background: var(--yellow);
}

/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  inset: 0;
  background: rgba(9, 11, 16, 0.96);
  z-index: 99999;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
body.light .mobile-drawer {
  background: rgba(255, 255, 255, 0.98);
}
.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 18px;
}
.mobile-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.drawer-link {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  display: block;
}
.drawer-link.active {
  background: var(--accent);
  color: #ffffff !important;
  border-color: var(--accent);
}
body.light .drawer-link.active {
  background: #6846ec;
  color: #ffffff !important;
  border-color: #6846ec;
}
.drawer-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

/* Views Architecture & Scrolling */
.view-container {
  width: 100%;
  min-height: calc(100vh - 58px);
  overflow-y: visible;
}
.view-container.hidden {
  display: none !important;
}

#playgroundView {
  flex: 1;
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 58px);
  min-height: calc(100vh - 58px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}
#playgroundView .workspace {
  flex: 1;
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 58px);
  min-height: 0;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  overflow: hidden;
  box-sizing: border-box;
}

/* =================== VIEW 1: DASHBOARD VIEW =================== */
.dashboard-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.dashboard-hero {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.12), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(124, 92, 255, 0.25);
  border-radius: 20px;
  padding: 36px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
body.light .dashboard-hero {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.08), rgba(56, 189, 248, 0.05));
  border-color: rgba(124, 92, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}
.hero-pill {
  display: inline-block;
  padding: 5px 12px;
  background: rgba(124, 92, 255, 0.2);
  color: #a78bfa;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
body.light .hero-pill {
  color: #6d28d9;
}
.dashboard-hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.dashboard-hero p {
  color: var(--muted);
  font-size: 1rem;
  max-width: 580px;
  line-height: 1.5;
  margin: 0;
}
.hero-cta-btn {
  padding: 14px 28px;
  font-size: 15px;
  border-radius: 12px;
  white-space: nowrap;
}

.dashboard-section {
  margin-bottom: 40px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-head h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}
.section-head p {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}
.access-matrix-badge {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Tool Access Cards Grid */
.tool-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.tool-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 92, 255, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
body.light .tool-card:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
}
.tool-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.2);
}
.tool-card.disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}
.tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.tool-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  color: white;
}
.tool-card-icon.web-icon { background: linear-gradient(135deg, #7c5cff, #4d9bff); }
.tool-card-icon.js-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.tool-card-icon.py-icon { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.tool-card-icon.sql-icon { background: linear-gradient(135deg, #10b981, #059669); }
.tool-card-icon.md-icon { background: linear-gradient(135deg, #ec4899, #db2777); }

.tool-access-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.tool-access-badge.granted {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
.tool-access-badge.restricted {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.tool-card h3 {
  font-size: 1.1rem;
  margin: 0 0 8px;
  color: var(--text);
  font-weight: 700;
}
.tool-card p {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
  margin: 0 0 16px;
  flex: 1;
}
.tool-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.tool-proj-count {
  font-weight: 600;
  color: #38bdf8;
}

/* Recent Projects Card */
.recent-projects-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

/* Platform Features Grid */
.dashboard-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 48px;
}
.feature-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
.feature-icon {
  font-size: 28px;
  margin-bottom: 12px;
}
.feature-box h4 {
  font-size: 1rem;
  margin: 0 0 6px;
  color: var(--text);
}
.feature-box p {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.5;
}

/* =================== PLAYGROUND SIDEBAR POLISH =================== */
.sidebar-top-nav {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.side-nav-btn {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.side-nav-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: rgba(124, 92, 255, 0.4);
}

.tool-item.restricted {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =================== VIEW 3: EXAMPLES LIBRARY =================== */
.examples-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}
.page-title-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 28px;
}
.page-title-banner h1 {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--text);
}
.page-title-banner p {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}
.library-search {
  min-width: 320px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.library-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

.examples-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.tool-filter-tabs, .diff-filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-tab:hover {
  background: var(--surface);
  color: var(--text);
}
.filter-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.diff-chip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.diff-chip.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--text);
}
.diff-chip.easy.active { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: #34d399; }
.diff-chip.moderate.active { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: #fbbf24; }
.diff-chip.hard.active { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: #f87171; }

.examples-count-bar {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.example-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, border-color 0.15s;
}
.example-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 92, 255, 0.4);
}
.example-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.example-tool-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}
.example-tool-tag.web { background: rgba(124, 92, 255, 0.2); color: #a78bfa; }
.example-tool-tag.javascript { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.example-tool-tag.python { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }
.example-tool-tag.sql { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.example-tool-tag.markdown { background: rgba(236, 72, 153, 0.2); color: #f472b6; }

.example-diff-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.example-diff-tag.easy { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.example-diff-tag.moderate { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.example-diff-tag.hard { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.example-card h3 {
  font-size: 1.05rem;
  margin: 0 0 6px;
  color: var(--text);
}
.example-category {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.example-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
  flex: 1;
}
.example-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.example-card-actions button {
  flex: 1;
}

/* =================== VIEW 4: CMS DYNAMIC PAGES =================== */
.cms-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}
.cms-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.back-link {
  color: #38bdf8;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.back-link:hover {
  text-decoration: underline;
}
.cms-updated {
  font-size: 12px;
  color: var(--muted);
}

.cms-article h1 {
  font-size: 2.3rem;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.cms-lead {
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 28px;
}
.cms-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}
.cms-body h2 {
  font-size: 1.5rem;
  margin: 32px 0 12px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.cms-body h3 {
  font-size: 1.2rem;
  margin: 24px 0 8px;
  color: var(--text);
}
.cms-body p {
  margin: 0 0 16px;
}
.cms-body ul, .cms-body ol {
  margin: 0 0 16px;
  padding-left: 24px;
}
.cms-body li {
  margin-bottom: 6px;
}
.cms-body blockquote {
  border-left: 4px solid var(--primary);
  margin: 20px 0;
  padding: 10px 18px;
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}

/* Contact Form */
.contact-form-section {
  margin-top: 40px;
}
.contact-form-card {
  padding: 28px;
  border-radius: 16px;
}
.contact-form-card h3 {
  margin: 0 0 20px;
  font-size: 1.2rem;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

/* =================== PROPER PROFESSIONAL SAAS FOOTER =================== */
.saas-footer {
  background: #06080c;
  border-top: 1px solid var(--line);
  padding: 56px 24px 28px;
  color: var(--muted);
  font-size: 13.5px;
}
body.light .saas-footer {
  background: #f1f5f9;
  border-top-color: #e2e8f0;
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}
.footer-grid {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  margin-bottom: 48px;
}
.footer-col.brand-col {
  flex: 0 1 320px;
  max-width: 360px;
}
.footer-col:not(.brand-col) {
  flex: 1 1 180px;
  min-width: 140px;
}
@media (max-width: 860px) {
  .footer-grid {
    flex-wrap: wrap;
    gap: 32px;
  }
  .footer-col.brand-col {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .footer-col:not(.brand-col) {
    flex: 1 1 calc(50% - 20px);
  }
}
@media (max-width: 540px) {
  .footer-grid {
    flex-direction: column;
    gap: 28px;
  }
  .footer-col:not(.brand-col) {
    flex: 1 1 100%;
  }
  .dashboard-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--text);
  font-size: 18px;
}
.footer-col p {
  line-height: 1.6;
  margin: 0 0 16px;
  max-width: 320px;
}
.tech-stack-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tech-stack-badges span {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-weight: 600;
}
.footer-col h4 {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-col li {
  margin-bottom: 10px;
}
.footer-link,
.footer-link-btn {
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  transition: color 0.15s;
}
.footer-link:hover,
.footer-link-btn:hover {
  color: var(--text);
}
#footerSupportEmail,
.footer-support-email {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 16px;
}
.footer-social-links {
  display: flex;
  gap: 16px;
  align-items: center;
}
.footer-social-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  min-height: 24px;
  min-width: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.footer-social-links a:hover {
  color: var(--text);
}

/* ========================================================================= */
/* TOPBAR OVERFLOW & MORE DROPDOWN (v9.1.0)                                  */
/* ========================================================================= */
.dropdown-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}
.dropdown-arrow {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.18s ease;
}
.dropdown-wrapper.open .dropdown-arrow {
  transform: rotate(180deg);
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--panel, #0f1219);
  border: 1px solid var(--line, #262d3a);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 6px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fadeInMenu 0.15s ease-out;
}
body.light .dropdown-menu {
  background: #ffffff;
  border-color: #dce2ea;
  box-shadow: 0 14px 34px rgba(50, 63, 85, 0.18);
}
@keyframes fadeInMenu {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: none;
  color: var(--text, #edf2f7);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}
body.light .dropdown-item {
  color: #171c26;
}
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--panel3, #191e29);
  color: var(--accent, #7c5cff);
  outline: none;
}
body.light .dropdown-item:hover, body.light .dropdown-item:focus {
  background: #f1f5f9;
  color: #6846ec;
}
.dropdown-divider {
  height: 1px;
  background: var(--line, #262d3a);
  margin: 4px 0;
}
body.light .dropdown-divider {
  background: #e2e8f0;
}
.dropdown-danger {
  color: var(--red, #ff6b7a) !important;
}
.dropdown-danger:hover {
  background: rgba(255, 107, 122, 0.1) !important;
}

/* ========================================================================= */
/* PRESENTATION MODE ENHANCEMENTS (v9.1.0)                                    */
/* ========================================================================= */
body.presentation {
  --editor-font: 20px;
}
body.presentation .topbar,
body.presentation .sidebar,
body.presentation .contextbar,
body.presentation .statusbar,
body.presentation .output-footer,
body.presentation #announcementBar,
body.presentation #updateBanner {
  display: none !important;
}
body.presentation #playgroundView,
body.presentation #playgroundView .workspace {
  height: 100vh !important;
  min-height: 100vh !important;
}
body.presentation .workspace {
  grid-template-columns: 1fr !important;
}
body.presentation .main-panel {
  grid-template-rows: 1fr !important;
  height: 100vh !important;
}
body.presentation .split-layout {
  padding: 6px !important;
  height: 100vh !important;
}

/* ========================================================================= */
/* ROLE DASHBOARD SECTIONS (INSTRUCTOR & STUDENT v9.1.0)                    */
/* ========================================================================= */
.role-dashboard-shell {
  margin-top: 28px;
  margin-bottom: 32px;
}
.role-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.role-stat-card {
  background: var(--panel, #0f1219);
  border: 1px solid var(--line, #262d3a);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.role-stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 92, 255, 0.35);
}
.role-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent, #7c5cff);
  line-height: 1.1;
}
.role-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #8e99aa);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-section-card {
  background: var(--panel, #0f1219);
  border: 1px solid var(--line, #262d3a);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.role-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #262d3a);
}
.role-section-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.role-section-header p {
  font-size: 12px;
  color: var(--muted, #8e99aa);
  margin: 2px 0 0;
}

/* ========================================================================= */
/* CLASSROOM v9.x REUSABLE MODAL & WORKSPACE STYLING                         */
/* ========================================================================= */
.classroom-modal-dialog {
  width: min(1040px, calc(100% - 32px)) !important;
  max-height: 88vh;
  overflow: hidden;
  border-radius: 18px !important;
  border: 1px solid var(--line, #262d3a);
  background: var(--panel, #0f1219);
  color: var(--text, #edf2f7);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
.classroom-modal-dialog[open] {
  display: flex !important;
  flex-direction: column;
}
body.light .classroom-modal-dialog {
  background: #ffffff;
  border-color: var(--line, #dce2ea);
  color: var(--text, #171c26);
  box-shadow: 0 24px 64px rgba(50, 63, 85, 0.16);
}
.classroom-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  background: var(--panel, #0f1219);
  border-bottom: 1px solid var(--line, #262d3a);
  position: sticky;
  top: 0;
  z-index: 10;
}
body.light .classroom-modal-header {
  background: #ffffff;
  border-bottom-color: var(--line, #dce2ea);
}
.classroom-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.classroom-modal-title h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--text, #edf2f7);
}
body.light .classroom-modal-title h2 {
  color: var(--text, #171c26);
}
.classroom-modal-title p {
  color: var(--muted, #8e99aa);
}
body.light .classroom-modal-title p {
  color: var(--muted, #6f7b8b);
}
.classroom-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  color: var(--text, #edf2f7);
}
body.light .classroom-modal-body {
  color: var(--text, #171c26);
}

.classroom-workspace-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  min-height: 480px;
}
@media (max-width: 820px) {
  .classroom-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.classroom-sidebar-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--line, #262d3a);
  padding-right: 16px;
}
body.light .classroom-sidebar-pane {
  border-right-color: var(--line, #dce2ea);
}
@media (max-width: 820px) {
  .classroom-sidebar-pane {
    border-right: none;
    border-bottom: 1px solid var(--line, #262d3a);
    padding-right: 0;
    padding-bottom: 16px;
  }
  body.light .classroom-sidebar-pane {
    border-bottom-color: var(--line, #dce2ea);
  }
}

.classroom-sidebar-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.classroom-sidebar-title strong {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted, #8e99aa);
}
body.light .classroom-sidebar-title strong {
  color: var(--muted, #6f7b8b);
}

.classroom-card-item {
  background: var(--panel2, #141822);
  border: 1px solid var(--line, #262d3a);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
body.light .classroom-card-item {
  background: #f7f9fc;
  border-color: #dce2ea;
}
.classroom-card-item:hover {
  background: var(--panel3, #191e29);
  border-color: rgba(124, 92, 255, 0.35);
}
body.light .classroom-card-item:hover {
  background: #eef2f7;
  border-color: #7c5cff;
}
.classroom-card-item.active {
  background: rgba(124, 92, 255, 0.08);
  border-color: var(--accent, #7c5cff);
  box-shadow: inset 3px 0 0 var(--accent, #7c5cff);
}
body.light .classroom-card-item.active {
  background: rgba(124, 92, 255, 0.1);
  border-color: #7c5cff;
  box-shadow: inset 3px 0 0 #7c5cff;
}
.classroom-card-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text, #edf2f7);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
body.light .classroom-card-name {
  color: #171c26;
}
.classroom-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted, #8e99aa);
}
body.light .classroom-card-meta {
  color: #6f7b8b;
}

.classroom-detail-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.classroom-nav-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line, #262d3a);
  padding-bottom: 8px;
}
body.light .classroom-nav-tabs {
  border-bottom-color: var(--line, #dce2ea);
}
.classroom-tab-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted, #8e99aa);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}
body.light .classroom-tab-btn {
  color: #6f7b8b;
}
.classroom-tab-btn:hover {
  color: var(--text, #edf2f7);
  background: var(--panel2, #141822);
}
body.light .classroom-tab-btn:hover {
  color: #171c26;
  background: #f1f5f9;
}
.classroom-tab-btn.active {
  color: #ffffff;
  background: var(--accent, #7c5cff);
}
body.light .classroom-tab-btn.active {
  color: #ffffff;
  background: #6846ec;
}

.classroom-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.classroom-badge.active {
  background: rgba(53, 208, 127, 0.12);
  color: var(--green, #35d07f);
  border: 1px solid rgba(53, 208, 127, 0.25);
}
.classroom-badge.archived {
  background: rgba(142, 153, 170, 0.12);
  color: var(--muted, #8e99aa);
  border: 1px solid rgba(142, 153, 170, 0.25);
}
.classroom-badge.submitted {
  background: rgba(243, 201, 105, 0.12);
  color: var(--yellow, #f3c969);
  border: 1px solid rgba(243, 201, 105, 0.25);
}
.classroom-badge.reviewed {
  background: rgba(124, 92, 255, 0.12);
  color: var(--accent2, #9b87ff);
  border: 1px solid rgba(124, 92, 255, 0.25);
}
.classroom-badge.pending {
  background: rgba(255, 107, 122, 0.12);
  color: var(--red, #ff6b7a);
  border: 1px solid rgba(255, 107, 122, 0.25);
}

.classroom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.classroom-table th {
  text-align: left;
  padding: 9px 12px;
  background: var(--panel2, #141822);
  color: var(--muted, #8e99aa);
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--line, #262d3a);
}
body.light .classroom-table th {
  background: #f8fafc;
  color: #475569;
  border-bottom-color: #e2e8f0;
}
.classroom-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line, #262d3a);
  color: var(--text, #edf2f7);
}
body.light .classroom-table td {
  border-bottom-color: #e2e8f0;
  color: #1e293b;
}
.classroom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
body.light .classroom-table tr:hover td {
  background: rgba(100, 116, 139, 0.06);
}

/* Classroom Cards & Form Element Classes (Dark & Light Theme) */
.classroom-box-card {
  background: var(--panel2, #141822);
  border: 1px solid var(--line, #262d3a);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text, #edf2f7);
}
body.light .classroom-box-card {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}

.classroom-box-card-dashed {
  background: var(--panel2, #141822);
  border: 1px dashed var(--line, #262d3a);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  color: var(--muted, #8e99aa);
}
body.light .classroom-box-card-dashed {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.classroom-form-input,
.classroom-form-select,
.classroom-form-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel2, #141822);
  border: 1px solid var(--line, #262d3a);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text, #edf2f7);
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s ease;
}
.classroom-form-input:focus,
.classroom-form-select:focus,
.classroom-form-textarea:focus {
  border-color: var(--accent, #7c5cff);
}
body.light .classroom-form-input,
body.light .classroom-form-select,
body.light .classroom-form-textarea {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
}

.submission-code-block {
  margin: 0;
  background: #090b10;
  border: 1px solid var(--line, #262d3a);
  border-radius: 0 6px 6px 6px;
  padding: 14px;
  font-family: var(--font-mono, "SFMono-Regular", Consolas, monospace);
  font-size: 12.5px;
  line-height: 1.5;
  max-height: 280px;
  overflow: auto;
  color: #f1f5f9;
}
body.light .submission-code-block {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* ========================================================================= */
/* ACCOUNT & PROFILE REDESIGN (v9.1.1)                                       */
/* ========================================================================= */
.account-modal-dialog {
  width: min(560px, calc(100% - 32px)) !important;
  max-height: 88vh;
  overflow: hidden;
  border-radius: 18px !important;
  border: 1px solid var(--line, #262d3a);
  background: var(--panel, #0f1219);
  color: var(--text, #edf2f7);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}
.account-modal-dialog[open] {
  display: flex !important;
  flex-direction: column;
}
body.light .account-modal-dialog {
  background: #ffffff;
  border-color: var(--line, #dce2ea);
  color: var(--text, #171c26);
  box-shadow: 0 24px 64px rgba(50, 63, 85, 0.16);
}
.account-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  background: var(--panel, #0f1219);
  border-bottom: 1px solid var(--line, #262d3a);
  position: sticky;
  top: 0;
  z-index: 10;
}
body.light .account-modal-header {
  background: #ffffff;
  border-bottom-color: var(--line, #dce2ea);
}
.account-modal-title h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--text, #fff);
}
.account-modal-title p {
  font-size: 12px;
  color: var(--muted, #8e99aa);
  margin: 2px 0 0;
}
.account-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}
.account-user-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.1) 0%, rgba(53, 208, 127, 0.05) 100%);
  border: 1px solid var(--line, #262d3a);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
body.light .account-user-banner {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.08) 0%, rgba(53, 208, 127, 0.06) 100%);
  border-color: var(--line, #dce2ea);
}
.account-avatar-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff 0%, #4f46e5 100%);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.35);
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.account-user-meta {
  flex: 1;
  min-width: 0;
}
.account-user-meta-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.account-user-meta-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.light .account-user-meta-name {
  color: var(--text, #171c26);
}
.account-user-meta-email {
  font-size: 12px;
  color: var(--muted, #8e99aa);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.light .account-user-meta-email {
  color: var(--muted, #6f7b8b);
}
.account-user-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #35d07f;
  margin-top: 4px;
}
.account-user-status-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #35d07f;
  box-shadow: 0 0 6px rgba(53, 208, 127, 0.6);
}
.account-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line, #262d3a);
  margin-bottom: 18px;
  padding-bottom: 2px;
}
body.light .account-tabs {
  border-bottom-color: var(--line, #dce2ea);
}
.account-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted, #8e99aa);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 6px 6px 0 0;
}
body.light .account-tab-btn {
  color: var(--muted, #6f7b8b);
}
.account-tab-btn:hover {
  color: var(--text, #fff);
}
body.light .account-tab-btn:hover {
  color: var(--text, #171c26);
}
.account-tab-btn.active {
  color: var(--primary, #7c5cff);
  border-bottom-color: var(--primary, #7c5cff);
}
body.light .account-tab-btn.active {
  color: var(--primary, #6846ec);
  border-bottom-color: var(--primary, #6846ec);
}
.account-tab-pane {
  display: none;
}
.account-tab-pane.active {
  display: block;
}
.account-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line, #262d3a);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 16px;
}
body.light .account-info-grid {
  background: #f8fafc;
  border-color: var(--line, #dce2ea);
}
.account-info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.account-info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #8e99aa);
}
body.light .account-info-label {
  color: var(--muted, #6f7b8b);
}
.account-info-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #fff);
}
body.light .account-info-value {
  color: var(--text, #171c26);
}
.account-pwd-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.account-pwd-wrapper input {
  padding-right: 40px !important;
  width: 100%;
}
body.light .account-pwd-wrapper input,
body.light #accountDisplayNameInput {
  background: #ffffff !important;
  border-color: var(--line, #dce2ea) !important;
  color: var(--text, #171c26) !important;
}
.account-pwd-toggle {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--muted, #8e99aa);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  line-height: 1;
}
body.light .account-pwd-toggle {
  color: var(--muted, #6f7b8b);
}
.account-pwd-toggle:hover {
  color: var(--text, #fff);
}
body.light .account-pwd-toggle:hover {
  color: var(--text, #171c26);
}
.account-form-hint {
  font-size: 11px;
  color: var(--muted, #8e99aa);
  margin-top: 4px;
}
body.light .account-form-hint {
  color: var(--muted, #6f7b8b);
}
.account-mismatch-warning {
  font-size: 11.5px;
  color: var(--red, #ff6b7a);
  margin-top: 4px;
  display: none;
}
@media (max-width: 540px) {
  .account-info-grid {
    grid-template-columns: 1fr;
  }
  .account-modal-dialog {
    width: calc(100% - 16px) !important;
    max-height: 94vh;
  }
}

/* ========================================================================= */
/* RESPONSIVE LAYOUT & ACCESSIBILITY AUDIT FIXES (v9.2.0)                   */
/* ========================================================================= */

/* Canvas & Live Preview Responsiveness across all screen sizes */
.preview-wrap iframe {
  max-width: 100% !important;
}

/* Laptop & Compact Desktop Topbar (<= 1400px): Hide secondary pills to prevent 1280px overflow */
@media (max-width: 1400px) {
  #navLinkAbout,
  #navLinkContact,
  #networkPill,
  #offlineBtn {
    display: none !important;
  }
}

/* Tablet & Mobile Topbar Optimization (<= 860px) */
@media (max-width: 860px) {
  #userMenuBtn,
  #logoutBtn {
    display: none !important;
  }
  .brand-copy small {
    display: none !important;
  }
}

/* Mobile Topbar Optimization (<= 640px) */
@media (max-width: 640px) {
  .topbar {
    padding: 0 8px;
    gap: 4px;
  }
  .brand-zone {
    gap: 6px;
  }
  .brand-copy strong {
    font-size: 13.5px;
  }
  .top-actions {
    gap: 4px;
  }
  .playground-top-controls {
    gap: 4px;
  }
  #themeBtn {
    display: none !important;
  }
  #autosaveLabel {
    display: none !important;
  }
  .save-indicator {
    padding: 0 2px;
  }
  #projectPill {
    padding: 0 6px !important;
    font-size: 11px !important;
  }
  #currentProjectTitle {
    display: none !important;
  }
  #runBtn {
    padding: 0 9px !important;
    font-size: 12px !important;
  }
  #runBtn kbd {
    display: none !important;
  }
  #topMoreBtn {
    padding: 0 8px !important;
    font-size: 12px !important;
  }
}

/* Small Screens Topbar (<= 360px) */
@media (max-width: 360px) {
  .topbar {
    padding: 0 4px;
    gap: 3px;
  }
  .brand-zone {
    gap: 4px;
  }
  .brand-mark {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }
  #headerBrandTitle {
    font-size: 11.5px;
  }
  #projectPill {
    display: none !important;
  }
  #autosaveIndicator {
    display: none !important;
  }
  #themeBtn {
    display: none !important;
  }
  #topMoreBtn {
    padding: 0 5px !important;
    font-size: 11px !important;
  }
}

/* ==========================================================================
   VIEWPORT-LOCKED MOBILE, TABLET & SMALL SCREEN PLAYGROUND UX
   ========================================================================== */

/* 1. Body & Shell Viewport Lock: Completely eliminate document-level scroll in Playground */
html.in-playground,
body.in-playground {
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.in-playground .app-shell {
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.in-playground #playgroundView {
  flex: 1 1 0% !important;
  height: calc(100vh - 58px) !important;
  height: calc(100dvh - 58px) !important;
  max-height: calc(100dvh - 58px) !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.in-playground .workspace {
  flex: 1 1 0% !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
}

body.in-playground .main-panel {
  flex: 1 1 0% !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.in-playground .split-layout {
  flex: 1 1 0% !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

/* 2. Mobile Layout Switcher Component */
.mobile-layout-switcher {
  display: none;
}

@media (max-width: 980px) {
  .context-copy p {
    display: none !important;
  }
  .contextbar {
    min-height: 44px;
    padding: 6px 10px;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .context-actions {
    gap: 5px;
  }

  .mobile-layout-switcher {
    display: inline-flex;
    align-items: center;
    background: var(--panel3);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 2px;
    gap: 2px;
  }
  .layout-toggle-btn {
    height: 28px;
    padding: 0 9px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 7px;
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .layout-toggle-btn:hover {
    color: var(--text);
  }
  .layout-toggle-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(124, 92, 255, 0.35);
  }
  .layout-switch-quick {
    font-size: 11px !important;
    padding: 0 8px !important;
    width: auto !important;
    color: var(--accent2) !important;
    font-weight: 600 !important;
  }

  /* Split Layout Grid Responsive Rules (Mobile & Tablet) */
  .split-layout {
    display: grid !important;
    padding: 6px !important;
    gap: 8px !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  /* Mode: Code Only */
  #splitLayout[data-mobile-layout="code"] {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
  }
  #splitLayout[data-mobile-layout="code"] .editor-pane {
    display: grid !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
  }
  #splitLayout[data-mobile-layout="code"] .output-pane,
  #splitLayout[data-mobile-layout="code"] .resize-handle {
    display: none !important;
  }

  /* Mode: Preview Only */
  #splitLayout[data-mobile-layout="preview"] {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
  }
  #splitLayout[data-mobile-layout="preview"] .output-pane {
    display: grid !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
  }
  #splitLayout[data-mobile-layout="preview"] .editor-pane,
  #splitLayout[data-mobile-layout="preview"] .resize-handle {
    display: none !important;
  }

  /* Mode: Split (Default) */
  #splitLayout[data-mobile-layout="split"],
  #splitLayout:not([data-mobile-layout]) {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr 1fr !important;
    height: 100% !important;
    max-height: 100% !important;
  }
  #splitLayout[data-mobile-layout="split"] .editor-pane,
  #splitLayout:not([data-mobile-layout]) .editor-pane {
    display: grid !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
  }
  #splitLayout[data-mobile-layout="split"] .output-pane,
  #splitLayout:not([data-mobile-layout]) .output-pane {
    display: grid !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
  }
  #splitLayout[data-mobile-layout="split"] .resize-handle,
  #splitLayout:not([data-mobile-layout]) .resize-handle {
    display: none !important;
  }
}

/* On tablets (720px - 980px): split mode renders side-by-side with full height */
@media (min-width: 720px) and (max-width: 980px) {
  #splitLayout[data-mobile-layout="split"],
  #splitLayout:not([data-mobile-layout]) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    grid-template-rows: 1fr !important;
  }
}

/* 3. CodeMirror & Canvas Touch & Small Screen Sizing (<= 768px down to 320px) */
@media (max-width: 768px) {
  .editor-pane,
  .editor-shell,
  .editor-mount {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .cm-editor {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .cm-editor .cm-scroller {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
  }
  .cm-editor .cm-gutters {
    flex-shrink: 0 !important;
  }
  .cm-editor .cm-content {
    min-width: 0 !important;
    flex: 1 1 0% !important;
    max-width: calc(100% - 32px) !important;
    box-sizing: border-box !important;
    white-space: pre-wrap !important;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    padding-right: 4px !important;
  }
  .cm-editor .cm-line {
    max-width: 100% !important;
    box-sizing: border-box !important;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
  }
  .preview-wrap {
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
  }
  .preview-wrap iframe {
    max-width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    touch-action: none !important;
  }
  .pane-toolbar {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }
  .pane-toolbar::-webkit-scrollbar {
    display: none;
  }
  .output-toolbar .device-controls {
    display: none !important;
  }
}

@media (max-width: 480px) {
  #fontSizeLabel,
  #fontDown,
  #fontUp {
    display: none !important;
  }
  #charStatus,
  #saveStatus {
    display: none !important;
  }
}
