:root {
  color-scheme: dark;
  --bg: #1e1e1e;
  --titlebar: #181818;
  --sidebar: #181818;
  --panel: #1e1e1e;
  --panel-alt: #252526;
  --line: #303031;
  --text: #cccccc;
  --muted: #858585;
  --accent: #007acc;
  --accent-soft: #264f78;
  --green: #89d185;
  --red: #f48771;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px; }
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.app-shell { display: grid; grid-template-rows: 36px minmax(0, 1fr) 22px; width: 100%; height: 100%; min-height: 480px; }

.titlebar { position: relative; z-index: 20; display: flex; align-items: center; min-width: 0; padding: 0 8px; gap: 12px; background: var(--titlebar); border-bottom: 1px solid #101010; user-select: none; }
.brand { display: flex; align-items: center; flex: 0 0 auto; gap: 7px; padding-right: 4px; color: #eeeeee; white-space: nowrap; }
.brand-mark { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 4px; background: #007acc; color: white; font: 700 8px var(--mono); }
.brand-name { font-size: 12px; font-weight: 600; }
.menubar { display: flex; align-items: center; height: 100%; gap: 1px; flex: 0 0 auto; }
.menu-wrap { position: relative; height: 100%; display: flex; align-items: center; }
.menu-trigger { height: 27px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent; color: #c9c9c9; cursor: pointer; font-size: 12px; }
.menu-trigger:hover, .menu-trigger[aria-expanded="true"] { background: #303031; color: #fff; }
.menu-dropdown { position: absolute; top: calc(100% - 1px); left: 0; z-index: 50; width: 250px; padding: 5px; border: 1px solid #454545; border-radius: 5px; background: #252526; box-shadow: 0 8px 22px #0008; }
.menu-dropdown button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 29px; padding: 0 9px; border: 0; border-radius: 3px; background: transparent; color: #d4d4d4; text-align: left; cursor: pointer; font-size: 12px; }
.menu-dropdown button:hover, .menu-dropdown button:focus-visible { outline: 0; background: #094771; color: white; }
.menu-dropdown kbd { margin-left: 22px; color: #999; font: 10px var(--sans); white-space: nowrap; }
.menu-dropdown button:hover kbd { color: #ddd; }
.menu-divider { height: 1px; margin: 4px 7px; background: #414141; }
.check-mark { width: 14px; color: #8fcf8f; text-align: center; }
.check-mark::after { content: ""; }
.check-mark.checked::after { content: "✓"; }
.window-title { position: absolute; left: 50%; max-width: 24vw; overflow: hidden; transform: translateX(-50%); color: #9d9d9d; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.titlebar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.runtime-pill { display: flex; align-items: center; gap: 7px; max-width: 210px; overflow: hidden; color: #a6a6a6; white-space: nowrap; font-size: 11px; }
.runtime-pill > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.status-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: #d7ba7d; }
.status-dot.ready { background: var(--green); box-shadow: 0 0 7px #89d18555; }
.status-dot.busy { background: #75beff; animation: pulse 1s infinite alternate; }
.status-dot.error { background: var(--red); }
.pages-badge { padding: 3px 6px; border: 1px solid #3b3b3b; border-radius: 3px; color: #8f8f8f; font: 9px var(--mono); letter-spacing: .4px; }

.workspace { display: grid; grid-template-columns: 48px 244px minmax(0, 1fr); min-height: 0; }
.workspace.sidebar-collapsed { grid-template-columns: 48px 0 minmax(0, 1fr); }
.activity-bar { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; border-right: 1px solid #252526; background: #181818; }
.activity-button { position: relative; display: grid; width: 48px; height: 46px; place-items: center; border: 0; border-left: 2px solid transparent; background: transparent; color: #858585; cursor: pointer; font: 22px/1 var(--sans); }
.activity-button:hover { color: #ddd; }
.activity-button.active { border-left-color: #fff; color: #fff; }
.activity-spacer { flex: 1; }
.account-button { font-size: 17px; }
.sidebar { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-right: 1px solid var(--line); background: var(--sidebar); }
.side-heading { display: flex; align-items: center; justify-content: space-between; height: 36px; flex: 0 0 36px; padding: 0 15px 0 18px; color: #bbbbbb; font-size: 11px; font-weight: 600; letter-spacing: .45px; }
.icon-button { display: inline-grid; width: 25px; height: 25px; place-items: center; border: 0; border-radius: 3px; background: transparent; color: #a9a9a9; cursor: pointer; font-size: 18px; }
.icon-button:hover { background: #333; color: white; }
.icon-button.small { width: 22px; height: 22px; font-size: 16px; }
.workspace-root { display: flex; align-items: center; width: 100%; height: 30px; flex: 0 0 30px; gap: 6px; padding: 0 8px 0 12px; border: 0; border-top: 1px solid #2a2a2a; border-bottom: 1px solid #2a2a2a; background: #181818; color: #ccc; text-align: left; cursor: default; }
.workspace-root strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; letter-spacing: .3px; }
.root-chevron { color: #999; font-size: 13px; }
.root-actions { display: flex; gap: 7px; margin-left: auto; color: #999; font-size: 14px; }
.root-actions button { width: 20px; height: 20px; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
.root-actions button:hover { color: white; }
.file-list { min-height: 55px; overflow: auto; padding: 4px 0; }
.file-row { display: flex; align-items: center; width: 100%; min-height: 27px; gap: 7px; padding: 0 12px 0 26px; border: 0; background: transparent; color: #c5c5c5; text-align: left; cursor: pointer; font-size: 12px; }
.file-row:hover { background: #2a2d2e; }
.file-row.active { background: #37373d; color: #fff; }
.file-type { width: 15px; color: #8bb9e8; font: 600 9px var(--mono); }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-spacer { flex: 1; min-height: 10px; }
.package-box { margin: 0; padding: 12px 12px 13px; border-top: 1px solid #2a2a2a; background: #181818; }
.package-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.package-icon { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 4px; background: #252526; color: #80c7ff; font-size: 14px; }
.package-heading div { display: grid; gap: 2px; }
.package-heading strong { color: #c8c8c8; font-size: 10px; letter-spacing: .35px; }
.package-heading small, .package-hint { color: #858585; font-size: 10px; line-height: 1.45; }
.package-form { display: flex; gap: 5px; }
.package-form input { width: 0; min-width: 0; height: 28px; flex: 1; padding: 0 7px; border: 1px solid #3c3c3c; border-radius: 2px; outline: 0; background: #1f1f1f; color: #ddd; font: 11px var(--mono); }
.package-form input:focus { border-color: var(--accent); }
.package-form button { height: 28px; padding: 0 9px; border: 0; border-radius: 2px; background: #0e639c; color: white; cursor: pointer; font-size: 11px; }
.package-form button:hover { background: #1177bb; }
.package-form button:disabled { opacity: .5; cursor: wait; }
.package-hint { margin: 8px 0 0; }
.storage-note { display: flex; align-items: center; gap: 7px; padding: 10px 12px; border-top: 1px solid #2a2a2a; color: #858585; font-size: 10px; }
.storage-icon { color: #89d185; font-size: 8px; }

.main-panel { display: grid; grid-template-rows: 36px minmax(170px, 1fr) minmax(145px, 27%); min-width: 0; min-height: 0; background: var(--panel); }
.main-panel.panel-hidden { grid-template-rows: 36px minmax(0, 1fr) 0; }
.main-panel.panel-hidden .output-panel { display: none; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 0 10px 0 14px; border-bottom: 1px solid #2b2b2b; background: #1f1f1f; }
.breadcrumbs { display: flex; align-items: center; min-width: 0; gap: 7px; color: #929292; white-space: nowrap; font-size: 11px; }
.breadcrumbs > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.breadcrumb-separator { color: #686868; }
.toolbar-actions { display: flex; align-items: center; gap: 4px; }
.tool-button, .run-button, .stop-button { display: inline-flex; align-items: center; justify-content: center; height: 27px; gap: 6px; padding: 0 8px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: #bcbcbc; cursor: pointer; font-size: 11px; }
.tool-button:hover { background: #333; color: white; }
.button-icon { color: #9c9c9c; font: 14px var(--mono); }
.run-button { background: #0e639c; color: #fff; }
.run-button:hover { background: #1177bb; }
.run-button:disabled { opacity: .55; cursor: wait; }
.run-button kbd { color: #d8eefe; font: 9px var(--mono); }
.play-icon { font-size: 9px; }
.stop-button { height: 25px; color: #e19a92; }
.stop-button:hover:not(:disabled) { background: #422b2b; }
.stop-button:disabled { opacity: .4; cursor: default; }
.editor-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #1e1e1e; }
.editor-tabbar { display: flex; align-items: center; justify-content: space-between; height: 35px; flex: 0 0 35px; border-bottom: 1px solid #2b2b2b; background: #181818; }
.active-file-tab { display: flex; align-items: center; height: 100%; gap: 7px; padding: 0 13px; border-top: 1px solid #007acc; border-right: 1px solid #2b2b2b; background: #1e1e1e; color: #ddd; font-size: 11px; }
.python-file-icon { color: #8bb9e8; font: 600 9px var(--mono); }
.dirty-mark { width: 7px; height: 7px; border-radius: 50%; background: #ccc; }
.editor-actions { display: flex; align-items: center; gap: 8px; padding: 0 10px; color: #858585; font-size: 10px; }
.editor-wrap { flex: 1; min-height: 0; direction: ltr; }
.CodeMirror { height: 100%; background: #1e1e1e; color: #d4d4d4; font: 13px/1.65 var(--mono); }
.CodeMirror-gutters { border-right: 1px solid #2b2b2b; background: #1e1e1e; }
.hussain-error-gutter { width: 20px; }
.error-gutter-marker { display: block; width: 18px; color: #f48771; font: 700 13px/1.65 var(--sans); text-align: center; }
.CodeMirror .hussain-error-line { background: #f4877118; }
.CodeMirror-linenumber { padding: 0 12px 0 8px; color: #858585; }
.CodeMirror-cursor { border-left: 2px solid #aeafad !important; }
.CodeMirror-selected { background: #264f78 !important; }
.CodeMirror-focused .CodeMirror-selected { background: #264f78 !important; }
.CodeMirror-activeline-background { background: #ffffff08; }
.cm-s-material-darker .CodeMirror-matchingbracket { color: #fff !important; outline: 1px solid #569cd6; background: #264f7880; }
.cm-s-material-darker span.cm-keyword { color: #c586c0; }
.cm-s-material-darker span.cm-def { color: #dcdcaa; }
.cm-s-material-darker span.cm-string { color: #ce9178; }
.cm-s-material-darker span.cm-number { color: #b5cea8; }
.cm-s-material-darker span.cm-comment { color: #6a9955; }
.editor-footer { display: flex; align-items: center; justify-content: space-between; height: 21px; flex: 0 0 21px; padding: 0 11px; border-top: 1px solid #2b2b2b; background: #1e1e1e; color: #858585; font: 10px var(--mono); }

.output-panel { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid #3c3c3c; background: #181818; }
.output-header { display: flex; align-items: center; justify-content: space-between; height: 35px; flex: 0 0 35px; padding: 0 12px; border-bottom: 1px solid #2b2b2b; }
.panel-tabs { display: flex; align-items: center; align-self: stretch; gap: 15px; }
.panel-tab { position: relative; padding: 0 2px; border: 0; background: transparent; color: #ccc; cursor: pointer; font-size: 10px; font-weight: 600; letter-spacing: .3px; }
.panel-tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 1px; background: #007acc; content: ""; }
.terminal-profile { color: #858585; font-size: 10px; }
.output-actions { display: flex; align-items: center; gap: 12px; color: #858585; font-size: 10px; }
.text-button { padding: 4px 7px; border: 0; border-radius: 3px; background: transparent; color: #a9a9a9; cursor: pointer; font-size: 10px; }
.text-button:hover:not(:disabled) { background: #333; color: white; }
.text-button:disabled { opacity: .4; cursor: default; }
.console { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px; outline: 0; color: #cccccc; font: 12px/1.7 var(--mono); direction: ltr; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.console:focus-visible { box-shadow: inset 0 0 0 1px #007acc55; }
.console-line { min-height: 1.7em; }
.console-line.error { color: #f48771; }
.console-line.system { color: #858585; }
.console-input-line { min-height: 1.7em; }
.console-input-prompt { color: #569cd6; }
.console-input-label { color: #cccccc; }
.console-input-value { min-width: 2ch; color: #f5f5f5; caret-color: #aeafad; }
.console-input-value[contenteditable="true"] { outline: 0; }
.console-input-value[contenteditable="true"]:empty::after { color: #aeafad; animation: cursor-blink 1s steps(2, start) infinite; content: "▏"; }
.console-input-line.cancelled { color: #858585; }
.console-prompt { margin-right: 7px; color: #569cd6; }
.welcome-line { color: #999; }
.welcome-line b { color: #d7d7d7; font-weight: 400; }

.status-bar { display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 0 9px; background: #007acc; color: #fff; font-size: 10px; user-select: none; }
.status-left, .status-right { display: flex; align-items: center; min-width: 0; gap: 12px; }
.status-item { display: inline-flex; align-items: center; height: 22px; white-space: nowrap; }
.status-branch { font-family: var(--mono); }
.status-right > span { white-space: nowrap; }
.toast { position: fixed; right: 18px; bottom: 34px; z-index: 100; max-width: min(440px, calc(100vw - 36px)); padding: 9px 13px; transform: translateY(8px); border: 1px solid #454545; border-radius: 4px; background: #252526; color: #e4e4e4; opacity: 0; pointer-events: none; box-shadow: 0 6px 22px #0008; font-size: 12px; transition: opacity .18s, transform .18s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: #85433c; }
.settings-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid #454545; border-radius: 8px; background: #252526; color: #d4d4d4; box-shadow: 0 16px 48px #0009; }
.settings-dialog::backdrop { background: #0009; backdrop-filter: blur(2px); }
.settings-heading { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 20px 14px; border-bottom: 1px solid #3b3b3b; }
.settings-heading h2 { margin: 4px 0 0; color: #eee; font-size: 17px; font-weight: 500; }
.settings-eyebrow { color: #9cdcfe; font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border-bottom: 1px solid #383838; cursor: pointer; }
.setting-row strong, .setting-row small { display: block; }
.setting-row strong { color: #ddd; font-size: 12px; font-weight: 500; }
.setting-row small { margin-top: 5px; color: #969696; font-size: 10px; line-height: 1.45; }
.setting-row input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 auto; accent-color: #0e639c; cursor: pointer; }
.font-size-control { display: flex; align-items: center; gap: 9px; }
.font-size-control input { width: 112px; accent-color: #3794ff; cursor: pointer; }
.font-size-control output { min-width: 36px; color: #9cdcfe; font: 11px var(--mono); text-align: right; }
.settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; color: #858585; font-size: 10px; }
.settings-done { padding: 6px 15px; border: 1px solid #1683c5; border-radius: 3px; background: #0e639c; color: white; cursor: pointer; font-size: 11px; }
.settings-done:hover { background: #1177bb; }
@keyframes pulse { to { opacity: .45; } }
@keyframes cursor-blink { to { visibility: hidden; } }

@media (max-width: 1120px) {
  .window-title { display: none; }
  .workspace { grid-template-columns: 46px 220px minmax(0, 1fr); }
  .workspace.sidebar-collapsed { grid-template-columns: 46px 0 minmax(0, 1fr); }
  .tool-button span:last-child { display: none; }
  .tool-button { width: 29px; padding: 0; }
}
@media (max-width: 760px) {
  .brand-name, .pages-badge { display: none; }
  .titlebar { gap: 5px; padding: 0 5px; }
  .menu-trigger { padding: 0 6px; font-size: 11px; }
  .runtime-pill { max-width: 145px; font-size: 10px; }
  .workspace { grid-template-columns: 42px 188px minmax(0, 1fr); }
  .workspace.sidebar-collapsed { grid-template-columns: 42px 0 minmax(0, 1fr); }
  .activity-button { width: 42px; }
  .toolbar-actions { gap: 1px; }
  .breadcrumbs > span:first-child { display: none; }
  .run-button { padding: 0 7px; }
  .run-button kbd { display: none; }
  .status-right { gap: 7px; }
}
@media (max-width: 560px) {
  .app-shell { min-height: 480px; grid-template-rows: 34px minmax(0, 1fr) 22px; height: 100dvh; }
  .runtime-pill { display: none; }
  .menu-trigger { padding: 0 3px; font-size: 10px; }
  .workspace { grid-template-columns: 40px minmax(0, 1fr); }
  .workspace.sidebar-collapsed { grid-template-columns: 40px 0 minmax(0, 1fr); }
  .activity-button { width: 40px; }
  .sidebar { grid-column: 2; grid-row: 1; position: absolute; z-index: 10; top: 34px; bottom: 22px; left: 40px; width: min(230px, calc(100vw - 40px)); box-shadow: 8px 0 18px #0007; }
  .workspace.sidebar-collapsed .sidebar { display: none; }
  .main-panel { grid-column: 2; grid-row: 1; }
  .breadcrumbs { gap: 4px; }
  .tool-button { display: none; }
  .stop-button { padding: 0 5px; }
  .run-button { font-size: 10px; }
  .output-actions { gap: 5px; }
  .terminal-profile { display: none; }
  .status-left .status-item:nth-child(2), .status-right > span:nth-child(2) { display: none; }
}
