/* ===================== THEMES ===================== */
:root,
[data-theme='dark-modern'] {
  color-scheme: dark;
  --fg: #cccccc;
  --fg-muted: #9d9d9d;
  --fg-strong: #ffffff;
  --accent: #0078d4;
  --accent-hover: #026ec1;
  --accent-fg: #ffffff;
  --focus: #0078d4;
  --border: #2b2b2b;
  --titlebar-bg: #181818;
  --activity-bg: #181818;
  --activity-fg: #d7d7d7;
  --activity-fg-inactive: #868686;
  --sidebar-bg: #181818;
  --editor-bg: #1f1f1f;
  --tabs-bg: #181818;
  --tab-bg: #181818;
  --tab-active-bg: #1f1f1f;
  --tab-active-fg: #ffffff;
  --tab-fg: #9d9d9d;
  --tab-active-top: #0078d4;
  --panel-bg: #181818;
  --status-bg: #181818;
  --status-fg: #cccccc;
  --status-item-hover: rgba(255, 255, 255, 0.12);
  --status-remote-bg: #0078d4;
  --input-bg: #313131;
  --input-border: #3c3c3c;
  --input-fg: #cccccc;
  --list-hover: #2a2d2e;
  --list-active: #04395e;
  --list-active-fg: #ffffff;
  --list-inactive: #37373d;
  --menu-bg: #1f1f1f;
  --menu-fg: #cccccc;
  --menu-sel: #0078d4;
  --menu-border: #454545;
  --widget-bg: #202020;
  --widget-border: #454545;
  --shadow: rgba(0, 0, 0, 0.36);
  --scroll: rgba(121, 121, 121, 0.4);
  --scroll-hover: rgba(100, 100, 100, 0.7);
  --badge-bg: #616161;
  --badge-fg: #f8f8f8;
  --button-sec-bg: #313131;
  --button-sec-hover: #3c3c3c;
  --error: #f14c4c;
  --warning: #cca700;
  --info: #3794ff;
  --success: #89d185;
  --modified: #e2c08d;
  --added: #73c991;
  --link: #4daafc;
  --sash: #0078d4;
  --guide: #404040;
  --guide-active: #707070;
  --selection: #264f78;
  --selection-inactive: #3a3d41;
  --line-hl: #282828;
  --match: rgba(234, 92, 0, 0.33);
  --match-current: #9e6a03;
  --linenr: #6e7681;
  --linenr-active: #cccccc;
  --cursor: #aeafad;
  --bracket: rgba(0, 100, 0, 0.1);
  --bracket-border: #888888;
  /* syntax */
  --syn-keyword: #569cd6;
  --syn-control: #c586c0;
  --syn-string: #ce9178;
  --syn-number: #b5cea8;
  --syn-comment: #6a9955;
  --syn-function: #dcdcaa;
  --syn-variable: #9cdcfe;
  --syn-type: #4ec9b0;
  --syn-tag: #569cd6;
  --syn-attr: #9cdcfe;
  --syn-punct: #808080;
  --syn-operator: #d4d4d4;
  --syn-property: #9cdcfe;
  --syn-selector: #d7ba7d;
  --syn-unit: #b5cea8;
  --syn-regexp: #d16969;
  --syn-constant: #4fc1ff;
  --syn-text: #cccccc;
  --syn-heading: #569cd6;
  --syn-invalid: #f44747;
}
[data-theme='dark-plus'] {
  color-scheme: dark;
  --fg: #cccccc;
  --fg-muted: #969696;
  --border: #3c3c3c;
  --accent: #007acc;
  --accent-hover: #0062a3;
  --focus: #007fd4;
  --titlebar-bg: #3c3c3c;
  --activity-bg: #333333;
  --activity-fg: #ffffff;
  --activity-fg-inactive: rgba(255, 255, 255, 0.4);
  --sidebar-bg: #252526;
  --editor-bg: #1e1e1e;
  --tabs-bg: #252526;
  --tab-bg: #2d2d2d;
  --tab-active-bg: #1e1e1e;
  --tab-fg: rgba(255, 255, 255, 0.5);
  --tab-active-top: transparent;
  --panel-bg: #1e1e1e;
  --status-bg: #007acc;
  --status-fg: #ffffff;
  --status-remote-bg: #16825d;
  --input-bg: #3c3c3c;
  --input-border: #3c3c3c;
  --list-hover: #2a2d2e;
  --list-active: #04395e;
  --list-inactive: #37373d;
  --menu-bg: #252526;
  --menu-sel: #04395e;
  --widget-bg: #252526;
  --line-hl: #2a2a2a;
  --guide: #404040;
  --linenr: #858585;
  --linenr-active: #c6c6c6;
  --badge-bg: #4d4d4d;
  --button-sec-bg: #3a3d41;
  --button-sec-hover: #45494e;
}
[data-theme='light-modern'] {
  color-scheme: light;
  --fg: #3b3b3b;
  --fg-muted: #6f6f6f;
  --fg-strong: #000000;
  --accent: #005fb8;
  --accent-hover: #0258a8;
  --focus: #005fb8;
  --border: #e5e5e5;
  --titlebar-bg: #f8f8f8;
  --activity-bg: #f8f8f8;
  --activity-fg: #1f1f1f;
  --activity-fg-inactive: #616161;
  --sidebar-bg: #f8f8f8;
  --editor-bg: #ffffff;
  --tabs-bg: #f8f8f8;
  --tab-bg: #f8f8f8;
  --tab-active-bg: #ffffff;
  --tab-active-fg: #3b3b3b;
  --tab-fg: #868686;
  --tab-active-top: #005fb8;
  --panel-bg: #f8f8f8;
  --status-bg: #f8f8f8;
  --status-fg: #3b3b3b;
  --status-item-hover: rgba(31, 31, 31, 0.11);
  --status-remote-bg: #005fb8;
  --input-bg: #ffffff;
  --input-border: #cecece;
  --input-fg: #3b3b3b;
  --list-hover: #f2f2f2;
  --list-active: #e4e6f1;
  --list-active-fg: #000000;
  --list-inactive: #e4e6f1;
  --menu-bg: #ffffff;
  --menu-fg: #3b3b3b;
  --menu-sel: #005fb8;
  --menu-border: #cecece;
  --widget-bg: #f8f8f8;
  --widget-border: #c8c8c8;
  --shadow: rgba(0, 0, 0, 0.16);
  --scroll: rgba(100, 100, 100, 0.4);
  --scroll-hover: rgba(100, 100, 100, 0.7);
  --badge-bg: #cccccc;
  --badge-fg: #3b3b3b;
  --button-sec-bg: #e5e5e5;
  --button-sec-hover: #cccccc;
  --error: #e51400;
  --warning: #bf8803;
  --info: #1a85ff;
  --success: #388a34;
  --modified: #895503;
  --added: #587c0c;
  --link: #005fb8;
  --sash: #005fb8;
  --guide: #d3d3d3;
  --guide-active: #939393;
  --selection: #add6ff;
  --selection-inactive: #e5ebf1;
  --line-hl: #f5f5f5;
  --match: rgba(234, 92, 0, 0.33);
  --match-current: #a8ac94;
  --linenr: #6e7681;
  --linenr-active: #171184;
  --cursor: #000000;
  --bracket-border: #b9b9b9;
  --syn-keyword: #0000ff;
  --syn-control: #af00db;
  --syn-string: #a31515;
  --syn-number: #098658;
  --syn-comment: #008000;
  --syn-function: #795e26;
  --syn-variable: #001080;
  --syn-type: #267f99;
  --syn-tag: #800000;
  --syn-attr: #e50000;
  --syn-punct: #800000;
  --syn-operator: #000000;
  --syn-property: #e50000;
  --syn-selector: #800000;
  --syn-unit: #098658;
  --syn-regexp: #811f3f;
  --syn-constant: #0070c1;
  --syn-text: #3b3b3b;
  --syn-heading: #800000;
  --syn-invalid: #cd3131;
  --syn-attrvalue: #0000ff;
  --syn-cssvalue: #0451a5;
}

/* ===================== BASE ===================== */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--editor-bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, Ubuntu, 'Droid Sans', sans-serif;
  font-size: 13px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
.codicon { font-size: 16px; line-height: 1; vertical-align: middle; }
#app { position: absolute; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-color: var(--scroll) transparent; scrollbar-width: thin; }

.boot { margin: auto; text-align: center; color: var(--fg-muted); }
.boot-logo .codicon { font-size: 64px; color: var(--accent); }
.boot-text { margin-top: 12px; }

/* ===================== TITLE BAR ===================== */
.titlebar {
  height: 35px;
  flex: none;
  display: flex;
  align-items: center;
  background: var(--titlebar-bg);
  border-bottom: 1px solid var(--border);
  user-select: none;
  position: relative;
  z-index: 20;
  padding-left: env(titlebar-area-x, 0);
  -webkit-app-region: drag;
  app-region: drag;
}
.titlebar > * { -webkit-app-region: no-drag; app-region: no-drag; }
.titlebar .app-icon { width: 35px; height: 35px; display: grid; place-items: center; flex: none; }
.titlebar .app-icon img { width: 16px; height: 16px; }
.menubar { display: flex; height: 100%; align-items: center; }
.menubar-item {
  padding: 0 8px;
  height: 26px;
  line-height: 26px;
  border-radius: 4px;
  cursor: default;
  color: var(--fg);
  font-size: 13px;
  background: none;
  border: 0;
}
.menubar-item:hover, .menubar-item.open { background: var(--status-item-hover, rgba(255, 255, 255, 0.1)); }
.titlebar .title-center { position: absolute; left: 50%; transform: translateX(-50%); width: min(38vw, 600px); }
.command-center {
  width: 100%;
  height: 24px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 12px;
  opacity: 0.9;
}
.command-center:hover { opacity: 1; border-color: var(--widget-border); }
.command-center .codicon { font-size: 14px; }
.titlebar .title-right { margin-left: auto; display: flex; align-items: center; gap: 2px; padding-right: 6px; }
.icon-btn {
  width: 28px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  border: 0;
  background: none;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
  flex: none;
}
.icon-btn:hover { background: var(--status-item-hover, rgba(255, 255, 255, 0.1)); }
.icon-btn.active { background: var(--list-inactive); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.titlebar .mobile-only { display: none; }

/* ===================== WORKBENCH ===================== */
.workbench { flex: 1; display: flex; min-height: 0; position: relative; }
.activitybar {
  width: 48px;
  flex: none;
  background: var(--activity-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  user-select: none;
}
.activitybar .spacer { flex: 1; }
.activity-item {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--activity-fg-inactive);
  position: relative;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
.activity-item .codicon { font-size: 24px; }
.activity-item:hover { color: var(--activity-fg); }
.activity-item.active { color: var(--activity-fg); }
.activity-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--activity-fg); }
[data-theme='dark-modern'] .activity-item.active::before, [data-theme='light-modern'] .activity-item.active::before { background: var(--accent); }
.activity-item .badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  font-size: 9px;
  line-height: 16px;
  text-align: center;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.activity-item .avatar { width: 24px; height: 24px; border-radius: 50%; }

.sidebar {
  flex: none;
  width: 260px;
  min-width: 170px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.sidebar-title {
  height: 35px;
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 8px 0 20px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--fg);
  user-select: none;
}
.sidebar-title .actions { margin-left: auto; display: flex; }
.sidebar-title .icon-btn { width: 22px; height: 22px; }
.sidebar-body { flex: 1; overflow: auto; min-height: 0; display: flex; flex-direction: column; }
.view-section-header {
  height: 22px;
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  padding-right: 4px;
  flex: none;
  border-top: 1px solid transparent;
}
.view-section-header .codicon { font-size: 16px; margin: 0 2px; }
.view-section-header .label { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.view-section-header .actions { display: none; }
.view-section-header .icon-btn { width: 22px; height: 22px; }
.sidebar:hover .view-section-header .actions, .view-section-header:focus-within .actions { display: flex; }
.view-section-header:focus { outline: 1px solid var(--focus); outline-offset: -1px; }

.editor-area { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.editor-row { flex: 1; display: flex; min-height: 0; }
.editor-group { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--editor-bg); position: relative; }
.preview-pane { flex: none; width: 45%; min-width: 200px; display: flex; flex-direction: column; border-left: 1px solid var(--border); background: var(--editor-bg); }

.sash { flex: none; position: relative; z-index: 5; touch-action: none; }
.sash.v { width: 4px; margin: 0 -2px; cursor: ew-resize; }
.sash.h { height: 4px; margin: -2px 0; cursor: ns-resize; }
.sash:hover, .sash.active { background: var(--sash); transition: background 0.1s 0.25s; }
.sash.active { transition: none; }
body.resizing iframe { pointer-events: none; }
body.resizing { user-select: none; }

/* ===================== TABS ===================== */
.tabs {
  height: 35px;
  flex: none;
  display: flex;
  background: var(--tabs-bg);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.tabs::-webkit-scrollbar { height: 3px; }
.tabs:hover { scrollbar-width: thin; }
.tab {
  height: 35px;
  display: flex;
  align-items: center;
  padding: 0 4px 0 10px;
  min-width: 0;
  max-width: 220px;
  background: var(--tab-bg);
  color: var(--tab-fg);
  border-right: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  position: relative;
  white-space: nowrap;
  gap: 6px;
  flex: none;
  margin-bottom: -1px;
}
.tab.active { background: var(--tab-active-bg); color: var(--tab-active-fg); }
.tab.active::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--tab-active-top); }
.tab.active { border-bottom: 1px solid var(--tab-active-bg); }
.tab .label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tab > .ficon, .tab > .codicon, .tab .tab-close { flex: none; }
.tab .desc { color: var(--fg-muted); font-size: 12px; opacity: 0.8; }
.tab .tab-close {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  visibility: hidden;
  position: relative;
}
.tab .tab-close:hover { background: var(--status-item-hover, rgba(255, 255, 255, 0.1)); }
.tab.active .tab-close, .tab:hover .tab-close { visibility: visible; }
.tab.dirty .tab-close { visibility: visible; }
.tab.dirty .tab-close .codicon::before { content: '\ea71'; font-size: 12px; } /* circle-filled */
.tab.dirty .tab-close:hover .codicon::before { content: '\ea76'; font-size: 16px; } /* close */
.tab.has-error .label { color: var(--error); }
.tab.has-warning .label { color: var(--warning); }
.tab.drop-before { box-shadow: inset 2px 0 0 var(--accent); }
.tab-actions { margin-left: auto; display: flex; align-items: center; padding: 0 6px; position: sticky; right: 0; background: var(--tabs-bg); }

.breadcrumbs {
  height: 22px;
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  color: var(--fg-muted);
  overflow: hidden;
  white-space: nowrap;
  background: var(--editor-bg);
  user-select: none;
}
.breadcrumbs .crumb { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.breadcrumbs .crumb:hover { color: var(--fg); }
.breadcrumbs .sep { margin: 0 2px; font-size: 14px; opacity: 0.8; }

.editor-stack { flex: 1; position: relative; min-height: 0; }
.editor-stack > .pane { position: absolute; inset: 0; display: none; }
.editor-stack > .pane.active { display: flex; flex-direction: column; }
.pane .cm-editor { flex: 1; min-height: 0; }

/* ===================== FILE ICONS ===================== */
.ficon {
  width: 16px;
  height: 16px;
  flex: none;
  display: inline-grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  font-family: Consolas, monospace;
  letter-spacing: -0.5px;
}
.ficon .codicon { font-size: 15px; }
.ficon.html { color: #e44d26; }
.ficon.css { color: #42a5f5; }
.ficon.js { color: #cbcb41; }
.ficon.json { color: #cbcb41; }
.ficon.md { color: #519aba; }
.ficon.image { color: #a074c4; }
.ficon.audio { color: #ef6c00; }
.ficon.video { color: #fd7d4a; }
.ficon.font { color: #f55385; }
.ficon.svg { color: #ffb13b; }
.ficon.txt { color: var(--fg-muted); }
.ficon.folder { color: #c09553; }
.ficon.pdf { color: #e53935; }
.ficon.word { color: #fff; background: #2b579a; border-radius: 3px; font-size: 10px; letter-spacing: 0; }

/* ===================== TREE ===================== */
.tree { outline: none; padding-bottom: 12px; user-select: none; flex: 1; min-height: 60px; }
.tree-row {
  height: 22px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  padding-right: 8px;
  position: relative;
  color: var(--fg);
}
.tree-row:hover { background: var(--list-hover); }
.tree-row.selected { background: var(--list-inactive); }
.tree:focus .tree-row.selected, .tree:focus-within .tree-row.selected { background: var(--list-active); color: var(--list-active-fg); outline: 1px solid var(--focus); outline-offset: -1px; }
.tree-row.drop-target, .tree.drop-root { background: rgba(83, 89, 93, 0.5) !important; }
.tree-row .twistie { width: 16px; flex: none; display: grid; place-items: center; }
.tree-row .label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tree-row .meta { font-size: 11px; color: var(--fg-muted); margin-left: 4px; }
.tree-row.dirty .label { color: var(--modified); }
.tree-row .deco { font-size: 11px; margin-left: auto; color: var(--modified); }
.tree-row.err .label { color: var(--error); }
/* Phân biệt rõ thư mục / tệp trong thư mục / tệp ở gốc dự án */
.tree-row.dir > .label { font-weight: 600; }
.tree-row.dir.open { color: var(--fg-strong, var(--fg)); }
.tree-row.nested.file > .label { opacity: 0.92; }
.tree-row .count { font-size: 10px; line-height: 14px; min-width: 16px; text-align: center; padding: 0 4px; border-radius: 8px; color: var(--fg-muted); background: var(--list-hover); flex: none; }
.tree-row .indent-guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--guide); pointer-events: none; }
.tree-row .indent-guide.active { background: var(--guide-active, var(--guide)); width: 2px; margin-left: -0.5px; }
.tree:hover .tree-row .indent-guide:not(.active) { background: var(--guide-active, var(--guide)); opacity: 0.7; }
.tree.no-project.drop-root { outline: 2px dashed var(--accent); outline-offset: -6px; }
.empty-view .drop-hint { color: var(--fg-muted); font-size: 12px; display: flex; gap: 6px; align-items: flex-start; margin-top: 14px; }
.empty-view .drop-hint .codicon { flex: none; margin-top: 1px; }
.tree-row input.rename {
  flex: 1;
  height: 20px;
  border: 1px solid var(--focus);
  background: var(--input-bg);
  color: var(--input-fg);
  outline: none;
  padding: 0 3px;
  min-width: 0;
}
.tree-row .rename-error {
  position: absolute;
  top: 21px;
  left: 30px;
  right: 6px;
  background: #5a1d1d;
  border: 1px solid var(--error);
  color: #fff;
  padding: 3px 6px;
  font-size: 12px;
  z-index: 3;
  white-space: normal;
}
.empty-view { padding: 10px 20px; color: var(--fg); line-height: 1.5; }
.empty-view p { margin: 0 0 10px; }

/* ===================== BUTTONS / INPUTS ===================== */
.btn {
  border: 1px solid transparent;
  border-radius: 2px;
  background: var(--accent);
  color: var(--accent-fg, #fff);
  padding: 4px 12px;
  min-height: 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 18px;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--button-sec-bg); color: var(--fg); }
.btn.secondary:hover { background: var(--button-sec-hover); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn .codicon { font-size: 14px; }
.input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--input-fg);
  height: 26px;
  padding: 0 6px;
  outline: none;
  border-radius: 2px;
  min-width: 0;
}
.input:focus { border-color: var(--focus); }
select.input { padding: 0 4px; }
textarea.input { height: auto; padding: 4px 6px; resize: vertical; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.checkbox input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

/* ===================== SEARCH VIEW ===================== */
.search-view { padding: 4px 12px 0 12px; display: flex; flex-direction: column; gap: 4px; }
.search-row { display: flex; gap: 2px; align-items: stretch; }
.search-box { position: relative; flex: 1; display: flex; }
.search-box .input { flex: 1; padding-right: 74px; height: 26px; }
.search-box .toggles { position: absolute; right: 2px; top: 2px; display: flex; gap: 1px; }
.toggle-btn {
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 3px;
  display: grid;
  place-items: center;
  background: none;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
}
.toggle-btn:hover { background: var(--status-item-hover, rgba(255, 255, 255, 0.1)); }
.toggle-btn.on { border-color: var(--focus); background: rgba(36, 137, 219, 0.51); color: #fff; }
[data-theme='light-modern'] .toggle-btn.on { background: rgba(0, 95, 184, 0.15); color: var(--fg); }
.search-summary { font-size: 12px; color: var(--fg-muted); padding: 6px 0 4px; }
.search-results { flex: 1; overflow: auto; }
.sr-file { height: 22px; display: flex; align-items: center; gap: 4px; padding-left: 4px; cursor: pointer; white-space: nowrap; }
.sr-file:hover, .sr-line:hover { background: var(--list-hover); }
.sr-file .count { margin-left: auto; margin-right: 8px; background: var(--badge-bg); color: var(--badge-fg); border-radius: 10px; padding: 0 6px; font-size: 11px; line-height: 16px; }
.sr-file .dir { color: var(--fg-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.sr-line { height: 22px; line-height: 22px; padding-left: 38px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.sr-line mark { background: var(--match); color: inherit; border: 1px solid transparent; }
.sr-line del { background: rgba(255, 0, 0, 0.2); }
.sr-line ins { background: rgba(155, 185, 85, 0.2); text-decoration: none; }

/* ===================== PANEL ===================== */
.panel {
  flex: none;
  height: 220px;
  min-height: 80px;
  background: var(--panel-bg);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.panel-header { height: 35px; display: flex; align-items: center; padding: 0 8px; flex: none; gap: 2px; user-select: none; }
.panel-tab {
  font-size: 11px;
  text-transform: uppercase;
  padding: 0 10px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--fg-muted);
  border: 0;
  background: none;
  position: relative;
}
.panel-tab:hover { color: var(--fg); }
.panel-tab.active { color: var(--fg); }
.panel-tab.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 4px; height: 1px; background: var(--fg); }
[data-theme='dark-modern'] .panel-tab.active::after, [data-theme='light-modern'] .panel-tab.active::after { background: var(--accent); }
.panel-tab .count { background: var(--badge-bg); color: var(--badge-fg); border-radius: 10px; padding: 0 5px; font-size: 11px; line-height: 16px; text-transform: none; }
.panel-header .actions { margin-left: auto; display: flex; gap: 2px; align-items: center; }
.panel-header .filter { height: 22px; width: 160px; font-size: 12px; }
.panel-body { flex: 1; min-height: 0; position: relative; }
.panel-body > .ptab { position: absolute; inset: 0; display: none; flex-direction: column; }
.panel-body > .ptab.active { display: flex; }

.console-out { flex: 1; overflow: auto; font-family: var(--mono); font-size: 12.5px; padding: 0 0 4px; user-select: text; }
.c-line { display: flex; gap: 6px; padding: 2px 12px 2px 8px; border-bottom: 1px solid rgba(128, 128, 128, 0.12); align-items: flex-start; line-height: 18px; }
.c-line > .codicon { font-size: 14px; margin-top: 2px; flex: none; width: 14px; }
.c-line .c-body { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }
.c-line .c-src { color: var(--fg-muted); font-size: 11.5px; cursor: pointer; flex: none; text-decoration: underline; text-decoration-color: transparent; }
.c-line .c-src:hover { color: var(--link); text-decoration-color: currentColor; }
.c-line .c-count { background: var(--badge-bg); color: var(--badge-fg); border-radius: 9px; padding: 0 6px; font-size: 11px; height: 16px; line-height: 16px; flex: none; margin-top: 1px; }
.c-line.warn { background: rgba(204, 167, 0, 0.1); color: var(--warning); border-color: rgba(204, 167, 0, 0.25); }
.c-line.warn .c-body { color: var(--fg); }
.c-line.error { background: rgba(241, 76, 76, 0.1); border-color: rgba(241, 76, 76, 0.25); }
.c-line.error > .codicon, .c-line.error .c-body > .c-msg { color: var(--error); }
.c-line.info > .codicon { color: var(--info); }
.c-line.input > .codicon, .c-line.result > .codicon { color: var(--fg-muted); }
.c-line.system { color: var(--fg-muted); font-style: italic; }
.c-hint { margin-top: 3px; padding: 4px 8px; border-left: 2px solid var(--info); background: rgba(55, 148, 255, 0.08); color: var(--fg); font-family: var(--ui-font, system-ui), sans-serif; font-size: 12.5px; white-space: normal; border-radius: 0 3px 3px 0; }
.c-hint b { color: var(--info); }
.c-stack { color: var(--fg-muted); font-size: 11.5px; margin-top: 2px; }
.v-string { color: var(--syn-string); }
.v-number, .v-bigint { color: var(--syn-number); }
.v-boolean, .v-null, .v-undefined { color: var(--syn-keyword); }
.v-fn { color: var(--syn-function); font-style: italic; }
.v-key { color: var(--syn-control); }
.v-el { color: var(--syn-tag); }
.v-symbol, .v-regexp, .v-date { color: var(--syn-regexp); }
.c-body > .v-string:only-child, .c-body > .v-plain { color: var(--fg); }
.v-obj > summary { cursor: pointer; list-style: none; display: inline; }
.v-obj > summary::before { content: '▸ '; color: var(--fg-muted); font-size: 10px; }
.v-obj[open] > summary::before { content: '▾ '; }
.v-obj .v-entries { padding-left: 16px; }
.v-obj { display: inline; }
.v-obj[open] { display: block; }
.console-input { display: flex; align-items: flex-start; gap: 4px; border-top: 1px solid var(--border); padding: 4px 8px; flex: none; }
.console-input .codicon { color: var(--accent); margin-top: 3px; font-size: 14px; }
.console-input textarea {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg);
  height: 20px;
  max-height: 120px;
  padding: 2px 0;
  line-height: 16px;
}
.problems-list { flex: 1; overflow: auto; user-select: none; }
.pb-file { height: 22px; display: flex; align-items: center; gap: 4px; padding-left: 8px; cursor: pointer; }
.pb-file .dir { color: var(--fg-muted); font-size: 12px; }
.pb-file .count { margin-left: 6px; background: var(--badge-bg); color: var(--badge-fg); border-radius: 10px; padding: 0 6px; font-size: 11px; line-height: 16px; }
.pb-item { min-height: 22px; display: flex; align-items: flex-start; gap: 6px; padding: 3px 8px 3px 30px; cursor: pointer; line-height: 16px; }
.pb-item:hover, .pb-file:hover { background: var(--list-hover); }
.pb-item .codicon { font-size: 14px; flex: none; margin-top: 1px; }
.pb-item .codicon-error { color: var(--error); }
.pb-item .codicon-warning { color: var(--warning); }
.pb-item .codicon-info { color: var(--info); }
.pb-item .pos { color: var(--fg-muted); margin-left: 4px; white-space: nowrap; }
.panel-empty { padding: 10px 16px; color: var(--fg-muted); }

/* ===================== PREVIEW ===================== */
.preview-toolbar { height: 35px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 6px; background: var(--tabs-bg); border-bottom: 1px solid var(--border); }
.preview-toolbar .addr {
  flex: 1;
  height: 24px;
  border-radius: 12px;
  font-size: 12px;
  min-width: 40px;
  padding: 0 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
}
.preview-title { font-size: 11px; text-transform: uppercase; color: var(--fg-muted); padding: 0 6px; white-space: nowrap; }
.preview-pane { container-type: inline-size; }
@container (max-width: 420px) { .preview-title { display: none; } }
.preview-stage { flex: 1; position: relative; overflow: auto; background: var(--editor-bg); display: flex; }
.preview-stage iframe { border: 0; background: #fff; flex: 1; width: 100%; height: 100%; display: block; }
.preview-stage.device { background: repeating-conic-gradient(rgba(128, 128, 128, 0.08) 0 25%, transparent 0 50%) 0 0 / 20px 20px; padding: 16px; align-items: flex-start; justify-content: center; }
.preview-stage.device iframe { flex: none; box-shadow: 0 2px 16px var(--shadow); border-radius: 6px; }
.preview-overlay { position: absolute; inset: 0; display: grid; place-items: center; color: var(--fg-muted); text-align: center; padding: 20px; }
.preview-loading { position: absolute; left: 0; right: 0; top: 0; height: 2px; overflow: hidden; }
.preview-loading::after { content: ''; position: absolute; height: 100%; width: 30%; background: var(--accent); animation: slide 1s infinite linear; }
@keyframes slide { from { left: -30%; } to { left: 100%; } }

/* ===================== STATUS BAR ===================== */
.statusbar {
  height: 22px;
  flex: none;
  display: flex;
  align-items: center;
  background: var(--status-bg);
  color: var(--status-fg);
  border-top: 1px solid var(--border);
  font-size: 12px;
  user-select: none;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-sizing: content-box;
}
[data-theme='dark-plus'] .statusbar { border-top-color: transparent; }
.statusbar .left, .statusbar .right { display: flex; height: 100%; align-items: center; }
.statusbar .right { margin-left: auto; }
.sb-item {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 5px;
  cursor: pointer;
  white-space: nowrap;
  border: 0;
  background: none;
  color: inherit;
  font-size: 12px;
}
.sb-item:hover { background: var(--status-item-hover); }
.sb-item .codicon { font-size: 14px; }
.sb-item.remote { background: var(--status-remote-bg); color: #fff; padding: 0 10px; }
.sb-item.remote:hover { filter: brightness(1.1); }
.sb-item.warn-bg { background: #c72e0f; color: #fff; }
.spin { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== MENUS ===================== */
.menu {
  position: fixed;
  z-index: 1000;
  min-width: 200px;
  max-width: 340px;
  background: var(--menu-bg);
  color: var(--menu-fg);
  border: 1px solid var(--menu-border);
  border-radius: 6px;
  box-shadow: 0 2px 8px var(--shadow);
  padding: 4px;
  user-select: none;
  outline: none;
  overflow-y: auto;
  max-height: calc(100vh - 40px);
}
.menu-item {
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 10px 0 8px;
  border-radius: 4px;
  cursor: pointer;
  gap: 8px;
  white-space: nowrap;
}
.menu-item .mi-icon { width: 16px; display: grid; place-items: center; flex: none; }
.menu-item .mi-icon .codicon { font-size: 14px; }
.menu-item .mi-label { flex: 1; }
.menu-item .mi-key { opacity: 0.75; font-size: 12px; margin-left: 24px; }
.menu-item:hover, .menu-item.focused { background: var(--menu-sel); color: #fff; }
.menu-item.disabled { opacity: 0.45; pointer-events: none; }
.menu-sep { height: 1px; background: var(--menu-border); margin: 4px 0; }

/* ===================== QUICK INPUT ===================== */
.quick-input {
  position: fixed;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, calc(100vw - 16px));
  z-index: 900;
  background: var(--widget-bg);
  border: 1px solid var(--widget-border);
  border-radius: 8px;
  box-shadow: 0 0 8px 2px var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  color: var(--fg);
}
.quick-input .qi-title { text-align: center; font-size: 12px; padding: 2px 0 6px; color: var(--fg-muted); }
.quick-input .input { height: 28px; width: 100%; border-radius: 3px; }
.quick-input .qi-msg { font-size: 12px; padding: 6px 4px 2px; color: var(--fg-muted); }
.quick-input .qi-msg.error { color: var(--error); }
.qi-list { max-height: min(440px, 60vh); overflow-y: auto; margin-top: 4px; }
.qi-item { min-height: 24px; display: flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.qi-item .qi-label { overflow: hidden; text-overflow: ellipsis; }
.qi-item .qi-desc { color: var(--fg-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.qi-item .qi-key { margin-left: auto; font-size: 11px; color: var(--fg-muted); display: flex; gap: 2px; }
.qi-item .qi-key kbd { border: 1px solid var(--widget-border); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; font-family: inherit; font-size: 11px; background: rgba(128, 128, 128, 0.17); }
.qi-item.focused { background: var(--list-active); color: var(--list-active-fg); }
.qi-item.focused .qi-desc, .qi-item.focused .qi-key { color: inherit; opacity: 0.85; }
.qi-item .match { color: var(--link); font-weight: 600; }
.qi-sep { font-size: 11px; color: var(--fg-muted); padding: 6px 8px 2px; text-align: right; border-top: 1px solid var(--widget-border); margin-top: 4px; }

/* ===================== DIALOG / NOTIFY ===================== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 950; display: grid; place-items: center; padding: 16px; }
.dialog {
  background: var(--widget-bg);
  border: 1px solid var(--widget-border);
  border-radius: 8px;
  box-shadow: 0 0 20px var(--shadow);
  width: min(460px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  color: var(--fg);
}
.dialog.wide { width: min(720px, 100%); }
.dialog-body { padding: 20px 20px 8px; display: flex; gap: 14px; overflow: auto; }
.dialog-body > .codicon { font-size: 32px; flex: none; }
.dialog-body > .codicon-warning { color: var(--warning); }
.dialog-body > .codicon-info { color: var(--info); }
.dialog-body > .codicon-error { color: var(--error); }
.dialog-body > .codicon-question { color: var(--info); }
.dialog-content { flex: 1; min-width: 0; line-height: 1.5; }
.dialog-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--fg-strong, var(--fg)); }
.dialog-detail { color: var(--fg-muted); white-space: pre-line; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; flex-wrap: wrap; }
.conflict-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.conflict-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; flex-wrap: wrap; }
.conflict-row .name { flex: 1; min-width: 140px; display: flex; gap: 6px; align-items: center; }
.conflict-row select { height: 26px; }

.notifications { position: fixed; right: 12px; bottom: 34px; z-index: 960; display: flex; flex-direction: column; gap: 8px; width: min(450px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  background: var(--widget-bg);
  border: 1px solid var(--widget-border);
  border-radius: 6px;
  box-shadow: 0 0 8px 2px var(--shadow);
  padding: 10px 10px 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toastIn 0.15s ease-out;
  color: var(--fg);
}
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }
.toast > .codicon { font-size: 16px; margin-top: 1px; }
.toast.info > .codicon { color: var(--info); }
.toast.warning > .codicon { color: var(--warning); }
.toast.error > .codicon { color: var(--error); }
.toast.success > .codicon { color: var(--success); }
.toast .t-body { flex: 1; min-width: 0; line-height: 1.45; word-break: break-word; }
.toast .t-actions { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast .t-actions .btn { min-height: 24px; padding: 2px 10px; }
.toast .progress { height: 2px; background: var(--border); margin-top: 8px; border-radius: 1px; overflow: hidden; }
.toast .progress > div { height: 100%; background: var(--accent); transition: width 0.2s; }

/* ===================== WELCOME / SETTINGS / VIEWERS ===================== */
.page { flex: 1; overflow: auto; padding: 40px 48px; }
.welcome { max-width: 1000px; margin: 0 auto; }
.welcome h1 { font-weight: 400; font-size: 32px; margin: 0 0 4px; color: var(--fg-strong, var(--fg)); }
.welcome .subtitle { font-size: 18px; color: var(--fg-muted); margin: 0 0 32px; }
.welcome .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.welcome h2 { font-size: 16px; font-weight: 400; margin: 0 0 10px; color: var(--fg-strong, var(--fg)); }
.welcome .links { display: flex; flex-direction: column; gap: 2px; margin-bottom: 28px; }
.welcome .link { display: flex; align-items: center; gap: 8px; color: var(--link); cursor: pointer; padding: 3px 0; background: none; border: 0; text-align: left; }
.welcome .link:hover { text-decoration: underline; }
.welcome .link .codicon { font-size: 16px; }
.welcome .recent { display: flex; flex-direction: column; gap: 2px; }
.welcome .recent-item { display: flex; align-items: baseline; gap: 10px; padding: 3px 0; }
.welcome .recent-item .name { color: var(--link); cursor: pointer; }
.welcome .recent-item .name:hover { text-decoration: underline; }
.welcome .recent-item .when { color: var(--fg-muted); font-size: 12px; }
.welcome .card { border-radius: 6px; padding: 12px 14px; background: var(--widget-bg); border: 1px solid var(--border); margin-bottom: 10px; display: flex; gap: 12px; cursor: pointer; align-items: flex-start; }
.welcome .card:hover { border-color: var(--focus); }
.welcome .card .codicon { font-size: 22px; color: var(--accent); }
.welcome .card .t { font-weight: 600; margin-bottom: 2px; color: var(--fg-strong, var(--fg)); }
.welcome .card .d { color: var(--fg-muted); font-size: 12.5px; line-height: 1.4; }
.welcome kbd, .kbd { border: 1px solid var(--widget-border); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; font-family: inherit; font-size: 11.5px; background: rgba(128, 128, 128, 0.15); }
.shortcut-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.shortcut-table td { padding: 4px 0; border-bottom: 1px solid var(--border); }
.shortcut-table td:last-child { text-align: right; white-space: nowrap; }

.settings { max-width: 860px; margin: 0 auto; }
.settings h1 { font-size: 26px; font-weight: 400; margin: 0 0 18px; }
.settings h2 { font-size: 18px; font-weight: 600; margin: 28px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.setting { padding: 10px 14px; margin: 0 -14px; border-radius: 4px; }
.setting:hover { background: rgba(128, 128, 128, 0.07); }
.setting .s-title { font-weight: 600; margin-bottom: 4px; }
.setting .s-title span { font-weight: 400; color: var(--fg-muted); }
.setting .s-desc { color: var(--fg-muted); margin-bottom: 8px; line-height: 1.45; }
.setting .input, .setting select { width: 300px; max-width: 100%; }

.viewer { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; gap: 12px; }
.viewer img { max-width: 100%; max-height: calc(100% - 40px); image-rendering: auto; background: repeating-conic-gradient(rgba(128, 128, 128, 0.25) 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.viewer img.zoomed { max-width: none; max-height: none; }
.viewer video { max-width: 100%; max-height: calc(100% - 40px); }
.viewer .info { color: var(--fg-muted); font-size: 12px; text-align: center; }
.viewer .font-sample { font-size: 32px; text-align: center; line-height: 1.4; }
/* Xem tài liệu PDF / Word ngay trong vùng soạn thảo */
.viewer.doc { padding: 0; gap: 0; align-items: stretch; justify-content: flex-start; overflow: hidden; min-height: 0; }
.doc-loading { margin: auto; display: flex; gap: 8px; align-items: center; color: var(--fg-muted); }
.doc-toolbar { flex: none; height: 32px; display: flex; align-items: center; gap: 2px; padding: 0 8px; background: var(--tabs-bg); border-bottom: 1px solid var(--border); }
.doc-toolbar .doc-info { color: var(--fg-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.doc-toolbar .doc-spacer { flex: 1; }
.doc-toolbar .doc-zoom { flex: none; min-width: 74px; height: 24px; border: 1px solid var(--input-border, var(--border)); border-radius: 4px; background: var(--input-bg); color: var(--fg); font-size: 12px; cursor: pointer; }
.doc-scroll { flex: 1; min-height: 0; overflow: auto; background: #525659; outline: none; padding: 12px 0; text-align: center; }
[data-theme^='light'] .doc-scroll { background: #d4d4d7; }
.pdf-page { margin: 0 auto 12px; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45); min-height: 40px; }
.pdf-page:last-child { margin-bottom: 0; }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.docx-host { display: inline-block; text-align: left; min-width: 100%; }
.docx-host .docx-wrapper { background: transparent; padding: 0 12px; align-items: center; }
.docx-host .docx-wrapper > section.docx { margin-bottom: 12px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45); color: #000; }

/* ===================== DRIVE VIEW ===================== */
.drive-view { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 10px; line-height: 1.45; }
.drive-view .account { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; }
.drive-view .account img { width: 32px; height: 32px; border-radius: 50%; }
.drive-view .account .who { flex: 1; min-width: 0; }
.drive-view .account .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-view .muted { color: var(--fg-muted); font-size: 12px; }
.drive-view .stat { display: flex; justify-content: space-between; font-size: 12.5px; padding: 2px 0; }
.drive-view .section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--fg-muted); margin-top: 6px; }
.drive-view .rproj { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px; }
.drive-view .rproj:hover { background: var(--list-hover); }
.drive-view .rproj .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-view .note { font-size: 12px; color: var(--fg-muted); border-left: 2px solid var(--info); padding: 4px 8px; background: rgba(55, 148, 255, 0.06); }

/* ===================== CODEMIRROR (VS Code look) ===================== */
/* JetBrains Mono (OFL) — used only where Cascadia/Consolas/SF Mono/Menlo don't exist (Android, Linux, ChromeOS) */
@font-face {
  font-family: 'CS Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../vendor/fonts/jetbrains-mono-vietnamese-400-normal.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'CS Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../vendor/fonts/jetbrains-mono-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'CS Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(../vendor/fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root { --mono: 'Cascadia Code', Consolas, 'SF Mono', Menlo, Monaco, 'CS Mono', monospace; --editor-font-size: 14px; }
.cm-editor { height: 100%; font-size: var(--editor-font-size); background: var(--editor-bg); color: var(--syn-text); }
.cm-editor.cm-focused { outline: none; }
.cm-scroller { font-family: var(--mono) !important; line-height: 1.5; font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; }
.cm-gutters { background: var(--editor-bg) !important; border: 0 !important; color: var(--linenr) !important; }
.cm-lineNumbers .cm-gutterElement { padding: 0 12px 0 16px !important; min-width: 48px; }
.cm-activeLineGutter { background: transparent !important; color: var(--linenr-active) !important; }
.cm-activeLine { background: transparent !important; box-shadow: inset 0 0 0 1px var(--line-hl); }
[data-theme='dark-plus'] .cm-activeLine { box-shadow: inset 0 0 0 1px #282828; }
.cm-content { caret-color: var(--cursor); padding: 0 10px 0 0 !important; }
.cm-cursor, .cm-dropCursor { border-left: 2px solid var(--cursor) !important; }
.cm-selectionBackground { background: var(--selection-inactive) !important; }
.cm-focused .cm-selectionBackground, .cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground { background: var(--selection) !important; }
.cm-selectionMatch { background: rgba(173, 214, 255, 0.15) !important; }
[data-theme='light-modern'] .cm-selectionMatch { background: rgba(173, 214, 255, 0.5) !important; }
.cm-matchingBracket { background: var(--bracket) !important; outline: 1px solid var(--bracket-border); color: inherit !important; }
.cm-nonmatchingBracket { color: var(--error) !important; }
.cm-searchMatch { background: var(--match) !important; outline: 1px solid transparent; }
.cm-searchMatch-selected { background: var(--match-current) !important; }
.cm-foldGutter .cm-gutterElement { width: 18px; display: grid; place-items: center; color: var(--fg-muted); cursor: pointer; opacity: 0; transition: opacity 0.2s; }
.cm-gutters:hover .cm-foldGutter .cm-gutterElement, .cm-foldGutter .cm-gutterElement.folded { opacity: 1; }
.cm-foldPlaceholder { background: rgba(128, 128, 128, 0.2) !important; border: 0 !important; color: var(--fg-muted) !important; padding: 0 4px !important; border-radius: 3px; }
.cm-tooltip { background: var(--widget-bg) !important; border: 1px solid var(--widget-border) !important; color: var(--fg) !important; border-radius: 4px; box-shadow: 0 0 8px 2px var(--shadow); font-family: system-ui, sans-serif; overflow: hidden; }
.cm-tooltip-autocomplete > ul { font-family: var(--mono) !important; max-height: 280px !important; min-width: 280px; }
.cm-tooltip-autocomplete > ul > li { padding: 2px 8px !important; line-height: 20px; display: flex; align-items: center; gap: 2px; }
.cm-tooltip-autocomplete > ul > li[aria-selected] { background: var(--list-active) !important; color: var(--list-active-fg) !important; }
.cm-completionMatchedText { text-decoration: none !important; color: var(--link); font-weight: 600; }
.cm-completionDetail { margin-left: auto !important; padding-left: 12px; font-style: normal !important; color: var(--fg-muted); font-size: 0.9em; }
.cm-completionInfo { background: var(--widget-bg) !important; border: 1px solid var(--widget-border) !important; padding: 6px 10px !important; max-width: 360px; }
.cm-completionIcon { width: 18px !important; padding-right: 4px !important; opacity: 1 !important; font-family: codicon !important; font-size: 14px; text-align: center; }
.cm-completionIcon-keyword::after { content: '\eb62' !important; color: var(--fg); }
.cm-completionIcon-function::after, .cm-completionIcon-method::after { content: '\ea8c' !important; color: #b180d7; }
.cm-completionIcon-variable::after { content: '\ea88' !important; color: #75beff; }
.cm-completionIcon-property::after { content: '\eb65' !important; color: var(--fg); }
.cm-completionIcon-class::after, .cm-completionIcon-type::after { content: '\eb5b' !important; color: #ee9d28; }
.cm-completionIcon-constant::after { content: '\eb5d' !important; color: var(--fg); }
.cm-completionIcon-text::after { content: '\ea93' !important; color: var(--fg); }
.cm-completionIcon-snippet::after { content: '\eb66' !important; color: var(--fg); }
.cm-completionIcon-namespace::after, .cm-completionIcon-enum::after { content: '\ea95' !important; color: #ee9d28; }
.cm-completionIcon-file::after { content: '\ea7b' !important; color: var(--fg); }
.cm-completionIcon-emmet::after { content: '\eb63' !important; color: var(--fg); }
.cm-diagnostic { padding: 4px 8px !important; font-family: system-ui, sans-serif; border-left-width: 3px !important; }
.cm-diagnostic-error { border-left-color: var(--error) !important; }
.cm-diagnostic-warning { border-left-color: var(--warning) !important; }
.cm-lintRange-error { background-image: none !important; text-decoration: underline wavy var(--error); text-underline-offset: 3px; text-decoration-skip-ink: none; }
.cm-lintRange-warning { background-image: none !important; text-decoration: underline wavy var(--warning); text-underline-offset: 3px; text-decoration-skip-ink: none; }
.cm-lint-marker { width: 0.8em !important; height: 0.8em !important; }
.cm-panels { background: var(--widget-bg) !important; color: var(--fg) !important; border: 0 !important; }
.cm-panels-top { border: 0 !important; }
.cm-panels-bottom { border-top: 1px solid var(--border) !important; }
.cm-panel.cm-panel-lint ul [aria-selected] { background: var(--list-active) !important; }
.cm-indent-markers { --indent-marker-bg-color: var(--guide) !important; --indent-marker-active-bg-color: var(--guide-active) !important; }
.cm-emmet-preview { background: var(--widget-bg) !important; border: 1px solid var(--widget-border) !important; font-family: var(--mono); padding: 4px 8px; font-size: 12px; }
.emmet-tracker { text-decoration: underline; text-decoration-color: var(--fg-muted); }
.cm-ws-trailing { background: rgba(255, 0, 0, 0.12); }
/* Color decorators (swatch before color values) */
.cm-color-swatch {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin: 0 3px 0 1px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  box-sizing: border-box;
  border: 1px solid rgba(128, 128, 128, 0.7);
  cursor: pointer;
  background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 6px 6px;
}
.cm-color-swatch > span { display: block; width: 100%; height: 100%; }
.cm-color-swatch:hover { outline: 1px solid var(--focus); }
@media (pointer: coarse) { .cm-color-swatch { width: 1em; height: 1em; margin-right: 4px; } }

/* VS Code-style find widget */
.cm-panels-top { position: absolute !important; top: 0; right: 14px; left: auto !important; z-index: 10; background: transparent !important; }
.find-widget {
  background: var(--widget-bg);
  box-shadow: 0 0 8px 2px var(--shadow);
  border: 1px solid var(--widget-border);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  padding: 4px 4px 4px 2px;
  display: flex;
  gap: 2px;
  font-size: 12px;
  width: 440px;
  max-width: calc(100vw - 70px);
}
.find-widget .fw-toggle { width: 18px; align-self: stretch; display: grid; place-items: center; cursor: pointer; border-radius: 3px; }
.find-widget .fw-toggle:hover { background: var(--status-item-hover); }
.find-widget .fw-rows { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.find-widget .fw-row { display: flex; align-items: center; gap: 2px; }
.find-widget .fw-input { position: relative; flex: 1; display: flex; min-width: 0; }
.find-widget .fw-input .input { flex: 1; height: 24px; padding-right: 72px; font-size: 13px; }
.find-widget .fw-input.no-toggles .input { padding-right: 26px; }
.find-widget .fw-input .toggles { position: absolute; right: 2px; top: 1px; display: flex; }
.find-widget .fw-count { min-width: 70px; padding: 0 4px; color: var(--fg-muted); white-space: nowrap; font-size: 12px; }
.find-widget .fw-count.none { color: var(--error); }
.find-widget .icon-btn { width: 22px; height: 22px; }

/* Mobile keyboard accessory bar */
.kbbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 800;
  display: none;
  background: var(--widget-bg);
  border-top: 1px solid var(--widget-border);
  overflow-x: auto;
  white-space: nowrap;
  padding: 4px;
  gap: 4px;
  scrollbar-width: none;
  touch-action: pan-x;
}
.kbbar::-webkit-scrollbar { display: none; }
.kbbar.show { display: flex; }
.kbbar button {
  flex: none;
  min-width: 38px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--widget-border);
  background: var(--input-bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 16px;
  padding: 0 8px;
}
.kbbar button:active { background: var(--accent); color: #fff; }
.kbbar button.wide { font-family: inherit; font-size: 13px; }

/* Bottom navigation (phones) */
.bottom-nav { display: none; }

/* ===================== RESPONSIVE: PHONES ===================== */
@media (max-width: 767px) {
  html, body { font-size: 14px; }
  .desktop-only { display: none !important; }
  .titlebar { height: 44px; }
  .titlebar .menubar, .titlebar .desktop-only { display: none; }
  .titlebar .mobile-only { display: inline-grid; }
  .titlebar .title-center { position: static; transform: none; flex: 1; width: auto; min-width: 0; padding: 0 4px; }
  .titlebar .command-center { height: 32px; font-size: 13px; justify-content: flex-start; padding: 0 10px; }
  .titlebar .command-center span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .titlebar .icon-btn { width: 40px; height: 40px; }
  .titlebar .icon-btn .codicon { font-size: 20px; }
  .titlebar .app-icon { display: none; }
  .activitybar { display: none; }
  .workbench { flex-direction: column; }
  .workbench > .sash { display: none; }
  .sidebar, .editor-area, .preview-pane { position: absolute; inset: 0; width: auto !important; height: auto !important; border: 0; display: none; }
  body[data-mview='files'] .sidebar,
  body[data-mview='search'] .sidebar,
  body[data-mview='drive'] .sidebar { display: flex; }
  body[data-mview='code'] .editor-area { display: flex; }
  body[data-mview='console'] .editor-area { display: flex; }
  body[data-mview='console'] .editor-row { display: none; }
  body[data-mview='console'] .panel { flex: 1; height: auto !important; display: flex !important; border-top: 0; }
  body[data-mview='code'] .panel { display: none !important; }
  body[data-mview='code'] .editor-row > .preview-pane, body[data-mview='code'] .editor-row > .sash { display: none !important; }
  body[data-mview='preview'] .editor-area { display: flex; }
  body[data-mview='preview'] .editor-row > .editor-group, body[data-mview='preview'] .editor-row > .sash, body[data-mview='preview'] .panel { display: none !important; }
  body[data-mview='preview'] .editor-row > .preview-pane { display: flex !important; position: static; flex: 1; width: auto !important; border: 0; }
  .editor-area > .sash { display: none; }
  .sidebar-title { height: 40px; font-size: 12px; }
  .tree-row { height: 36px; font-size: 15px; }
  .tree-row .twistie .codicon { font-size: 18px; }
  .ficon { width: 20px; height: 20px; font-size: 11px; }
  .ficon .codicon { font-size: 18px; }
  .view-section-header { height: 32px; font-size: 12px; }
  .view-section-header .actions { display: flex; }
  .view-section-header .icon-btn, .sidebar-title .icon-btn { width: 34px; height: 34px; }
  .tabs { height: 40px; }
  .tab { height: 40px; padding: 0 2px 0 12px; max-width: 200px; }
  .tab .tab-close { visibility: visible; width: 30px; height: 30px; }
  .breadcrumbs { display: none; }
  .cm-lineNumbers .cm-gutterElement { padding: 0 6px 0 4px !important; min-width: 28px; }
  .cm-foldGutter { display: none !important; }
  .panel-header { height: 40px; overflow-x: auto; }
  .panel-tab { font-size: 12px; }
  .panel-header .filter { width: 100px; }
  .console-input textarea { font-size: 16px; height: 24px; }
  .c-line { font-size: 13px; }
  .bottom-nav {
    display: flex;
    flex: none;
    height: calc(54px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--activity-bg);
    border-top: 1px solid var(--border);
    user-select: none;
  }
  .bottom-nav button {
    flex: 1;
    border: 0;
    background: none;
    color: var(--activity-fg-inactive);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    position: relative;
    padding: 0;
  }
  .bottom-nav button .codicon { font-size: 22px; }
  .bottom-nav button.active { color: var(--accent); }
  .bottom-nav button .badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; font-size: 10px; line-height: 16px; background: var(--error); color: #fff; padding: 0 4px; }
  .statusbar { display: none; }
  body.kb-open .bottom-nav { display: none; }
  .page { padding: 20px 16px; }
  .welcome .cols { grid-template-columns: 1fr; gap: 8px; }
  .welcome h1 { font-size: 26px; }
  .welcome .subtitle { font-size: 15px; margin-bottom: 20px; }
  .quick-input { top: 8px; }
  .qi-item { min-height: 36px; }
  .menu-item { height: 38px; font-size: 14px; }
  .menu { min-width: 220px; }
  .notifications { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); right: 8px; width: calc(100vw - 16px); }
  .find-widget { width: calc(100vw - 20px); }
  .cm-panels-top { right: 4px; }
  .find-widget .fw-input .input { font-size: 16px; height: 30px; }
  .input { font-size: 16px; height: 34px; }
  .search-box .input { height: 34px; }
  .preview-toolbar { height: 40px; }
  .preview-toolbar .icon-btn { width: 36px; height: 36px; }
  .preview-title { display: none; }
  .drive-view { font-size: 14px; }
  .setting .input, .setting select { width: 100%; }
}

/* Tablet: narrow sidebar & preview */
@media (min-width: 768px) and (max-width: 1100px) {
  .sidebar { width: 220px; }
}
@media (pointer: coarse) {
  .sash.v { width: 12px; margin: 0 -6px; }
  .sash.h { height: 12px; margin: -6px 0; }
}
