@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  --bg: #090c13;
  --bg-soft: #0d111a;
  --surface: #111620;
  --surface-2: #151b27;
  --surface-3: #1a2230;
  --glass: rgba(17, 22, 32, .82);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #edf2fb;
  --muted: #8a96aa;
  --muted-2: #606c80;
  --accent: #708dff;
  --accent-2: #785df4;
  --accent-soft: rgba(112, 141, 255, .14);
  --success: #3ed6a0;
  --warning: #f6bb58;
  --danger: #ff6b75;
  --shadow: 0 24px 80px rgba(0, 0, 0, .42);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "DM Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  --display: Manrope, var(--sans);
}

body[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-soft: #edf0f6;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef1f7;
  --glass: rgba(255, 255, 255, .86);
  --line: rgba(20, 31, 52, .09);
  --line-strong: rgba(20, 31, 52, .15);
  --text: #182033;
  --muted: #68758a;
  --muted-2: #929caf;
  --accent: #526fe9;
  --accent-2: #6b50dc;
  --accent-soft: rgba(82, 111, 233, .1);
  --shadow: 0 24px 70px rgba(42, 52, 74, .15);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
::selection { color: #fff; background: #5d78e8; }
.is-hidden { display: none !important; }

.boot-screen { position: fixed; inset: 0; z-index: 9999; display: grid; place-content: center; gap: 23px; background: var(--bg); transition: opacity .45s ease, visibility .45s; }
.boot-screen.done { opacity: 0; visibility: hidden; }
.boot-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: auto; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #7192ff, #7658eb); box-shadow: 0 20px 60px rgba(86, 110, 236, .38); font-family: var(--display); font-size: 27px; font-weight: 900; }
.boot-line { width: 150px; height: 3px; overflow: hidden; border-radius: 3px; background: var(--line); }
.boot-line i { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--accent); animation: boot 1s ease-in-out infinite; }
@keyframes boot { from { transform: translateX(-110%); } to { transform: translateX(350%); } }

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark, .mini-logo { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #6f91ff, #7657e8); box-shadow: 0 10px 32px rgba(83, 106, 229, .35); font-family: var(--display); font-size: 18px; font-weight: 900; }
.brand b { display: block; font-family: var(--display); font-size: 17px; line-height: 1; letter-spacing: -.025em; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1; letter-spacing: .1em; text-transform: uppercase; }
.brand.compact .brand-mark { width: 35px; height: 35px; border-radius: 11px; font-size: 15px; }
.brand.compact small { margin-top: 3px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--surface-2); transition: .18s ease; }
.icon-button:hover { color: var(--text); border-color: var(--line-strong); transform: translateY(-1px); }
.theme-icon { font-size: 17px; line-height: 1; }

/* Login */
.login-view { position: relative; width: 100%; height: 100%; min-height: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; background: linear-gradient(145deg, var(--bg), var(--bg-soft)); }
.login-view::before { position: fixed; inset: 0; content: ""; opacity: .28; pointer-events: none; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 70px 70px; mask-image: linear-gradient(to bottom, black, transparent 75%); }
.login-orb { position: fixed; width: 460px; height: 460px; border-radius: 50%; pointer-events: none; filter: blur(95px); opacity: .16; }
.orb-a { top: -170px; left: -120px; background: #486eff; }
.orb-b { right: -120px; bottom: -180px; background: #19a895; }
.login-nav { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; width: min(1220px, calc(100% - 48px)); margin: 0 auto; padding: 26px 0; }
.login-shell { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .65fr); align-items: center; gap: clamp(60px, 9vw, 145px); width: min(1180px, calc(100% - 48px)); min-height: calc(100vh - 190px); margin: 0 auto; padding: 35px 0 75px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 25px; color: #91a7fb; font-size: 12px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.eyebrow i { width: 20px; height: 1px; background: currentColor; box-shadow: 6px 0 15px currentColor; }
.login-copy h1 { max-width: 760px; margin: 0; font-family: var(--display); font-size: clamp(50px, 6.7vw, 88px); font-weight: 800; line-height: .99; letter-spacing: -.065em; }
.login-copy h1 em { color: transparent; font-style: normal; background: linear-gradient(100deg, #7d9aff 10%, #8d79ed 65%, #61c7bd); -webkit-background-clip: text; background-clip: text; }
.login-copy > p { max-width: 670px; margin: 28px 0 34px; color: var(--muted); font-size: 17px; line-height: 1.75; }
.feature-row { display: flex; flex-wrap: wrap; gap: 10px; }
.feature-row span { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 12px; }
.feature-row b { color: var(--accent); font-family: var(--mono); font-size: 10px; }
.glass-card { border: 1px solid var(--line-strong); background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(24px); }
.login-card { padding: 35px; border-radius: 26px; }
.login-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 44px; }
.mini-logo { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }
.secure-pill { display: inline-flex; align-items: center; padding: 7px 9px; border: 1px solid rgba(62,214,160,.2); border-radius: 999px; color: var(--success); background: rgba(62,214,160,.07); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.login-card h2 { margin: 0 0 10px; font-family: var(--display); font-size: 29px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 27px; color: var(--muted); line-height: 1.65; }
.google-button-host { min-height: 44px; overflow: hidden; }
.google-button-host > div, .google-button-host iframe { width: 100% !important; }
.login-warning { padding: 12px; border: 1px solid rgba(246,187,88,.3); border-radius: 11px; color: #f5ca80; background: rgba(246,187,88,.09); line-height: 1.5; }
.privacy-note { display: flex; gap: 11px; align-items: flex-start; margin-top: 27px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 11px; line-height: 1.55; }
.privacy-note span { color: var(--accent); }
.privacy-note p { margin: 0; }
.login-footer { position: relative; z-index: 1; display: flex; justify-content: space-between; width: min(1220px, calc(100% - 48px)); margin: auto; padding: 21px 0; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 11px; }

/* Workspace */
.app-shell { display: grid; grid-template-rows: 56px minmax(0, 1fr) 24px; width: 100%; height: 100%; background: var(--bg); }
.topbar { position: relative; z-index: 40; display: flex; align-items: center; gap: 24px; padding: 0 13px 0 15px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar .brand { min-width: 155px; }
.workspace-mode-switch { position: relative; display: flex; align-items: center; flex: 0 0 auto; gap: 6px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); }
.workspace-mode-label { color: var(--muted-2); font-size: 7px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.workspace-mode-select { min-width: 92px; height: 27px; padding: 0 23px 0 7px; border: 0; border-radius: 7px; outline: none; color: #fff; background: linear-gradient(135deg,#607ff0,#704fd9); box-shadow: 0 5px 15px rgba(76,96,210,.22); font-size: 9px; font-weight: 800; cursor: pointer; }
.workspace-mode-select option { color: var(--text); background: var(--surface-2); }
.project-switcher-wrap { display: flex; align-items: center; gap: 9px; min-width: 0; }
.top-label { color: var(--muted-2); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.project-select { width: min(260px, 24vw); height: 34px; padding: 0 32px 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); outline: none; background: var(--surface-2); }
.project-select:focus { border-color: var(--accent); }
.save-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-2); font-size: 10px; white-space: nowrap; }
.save-state::before { width: 5px; height: 5px; border-radius: 50%; background: var(--success); content: ""; }
.save-state.saving::before { background: var(--warning); animation: blink 1s infinite; }
.save-state.error::before { background: var(--danger); }
@keyframes blink { 50% { opacity: .3; } }
.top-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 0 13px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 700; transition: transform .18s ease, border-color .18s, background .18s, box-shadow .18s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: default; opacity: .42; transform: none; }
.button.primary { color: #fff; background: linear-gradient(135deg, #6688f7, #735ae9); box-shadow: 0 8px 25px rgba(75, 98, 216, .25); }
.button.primary:hover { box-shadow: 0 10px 30px rgba(75, 98, 216, .4); }
.button.ghost { border-color: var(--line); color: var(--muted); background: var(--surface-2); }
.button.ghost:hover { color: var(--text); border-color: var(--line-strong); }
.button.danger { border-color: rgba(255,107,117,.23); color: var(--danger); background: rgba(255,107,117,.08); }
.restore-project-button:not(:disabled) { color: #dfe6ff; border-color: rgba(112,141,255,.24); background: var(--accent-soft); }
.button-icon { font-size: 16px; line-height: 1; }
.avatar-button { position: relative; width: 35px; height: 35px; padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface-3); }
.avatar-button img { width: 100%; height: 100%; object-fit: cover; }
.avatar-button > span { display: grid; place-items: center; width: 100%; height: 100%; color: #fff; background: linear-gradient(135deg,#5e7ce2,#704cc6); font-size: 12px; font-weight: 800; }
.avatar-button i { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border: 2px solid var(--surface); border-radius: 50%; background: var(--success); }
.dropdown { position: absolute; top: 50px; right: 12px; z-index: 80; min-width: 240px; padding: 7px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.user-summary { display: flex; align-items: center; gap: 11px; padding: 9px 8px 13px; }
.user-summary img { width: 35px; height: 35px; border-radius: 10px; object-fit: cover; background: var(--surface-3); }
.user-summary div { min-width: 0; }
.user-summary b, .user-summary span { display: block; max-width: 165px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-summary b { margin-bottom: 4px; font-size: 12px; }
.user-summary span { color: var(--muted); font-size: 10px; }
.dropdown hr { height: 1px; margin: 6px; border: 0; background: var(--line); }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; text-align: left; font-size: 12px; }
.dropdown-item:hover { color: var(--text); background: var(--surface-3); }
.danger-text { color: var(--danger); }
.mobile-mode-tabs { display: none; }

.workspace { display: grid; grid-template-columns: minmax(360px, 55fr) 5px minmax(320px, 45fr); min-height: 0; overflow: hidden; }
.work-pane { min-width: 0; min-height: 0; background: var(--bg-soft); }
.editor-pane { display: grid; grid-template-rows: 41px minmax(0, 1fr); }
.pane-toolbar, .preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.pane-toolbar { padding: 0 8px 0 13px; }
.file-breadcrumb { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.file-breadcrumb span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-searchbar { display: flex; align-items: center; width: min(230px, 29%); min-width: 125px; height: 29px; margin-left: auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; color: var(--muted-2); background: var(--bg-soft); transition: border-color .18s, box-shadow .18s; }
.editor-searchbar:focus-within { border-color: rgba(112,141,255,.55); box-shadow: 0 0 0 2px var(--accent-soft); }
.editor-searchbar > span { padding-left: 8px; font-size: 11px; }
.editor-searchbar input { width: 100%; min-width: 35px; height: 100%; padding: 0 6px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 9px; }
.editor-searchbar input::placeholder { color: var(--muted-2); }
.editor-searchbar em { min-width: 30px; color: var(--muted-2); font-family: var(--mono); font-size: 7px; font-style: normal; text-align: center; }
.editor-searchbar button { width: 23px; height: 100%; flex: 0 0 auto; padding: 0; border: 0; border-left: 1px solid var(--line); color: var(--muted); background: transparent; font-size: 10px; }
.editor-searchbar button:hover { color: var(--text); background: var(--surface-3); }
.monaco-editor .nexa-search-match { border-radius: 2px; background: rgba(246,187,88,.25); box-shadow: inset 0 0 0 1px rgba(246,187,88,.32); }
.monaco-editor .nexa-search-match-active { border-radius: 2px; background: rgba(112,141,255,.42); box-shadow: inset 0 0 0 1px rgba(140,163,255,.7); }
.language-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 2px; background: var(--muted-2); }
.language-dot.tsx, .language-dot.ts { background: #4fa5e8; }.language-dot.css { background: #b064dc; }.language-dot.html { background: #e87342; }.language-dot.php { background: #777bb3; }.language-dot.json { background: #d5b54b; }.language-dot.js, .language-dot.jsx { background: #e6cf5c; }
.pane-actions, .preview-tools, .device-switch { display: flex; align-items: center; gap: 4px; }
.mini-button { height: 28px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); background: transparent; font-size: 10px; white-space: nowrap; }
.mini-button:hover { color: var(--text); border-color: var(--line); background: var(--surface-3); }
.mini-button:disabled { cursor: default; opacity: .3; }
.mini-button:disabled:hover { color: var(--muted); border-color: transparent; background: transparent; }
.history-button { min-width: 28px; padding: 0 6px; font-size: 15px; }
.inspect-button { display: inline-flex; align-items: center; gap: 5px; }
.inspect-button.active { color: #fff; border-color: rgba(112,141,255,.48); background: linear-gradient(135deg,#607ff0,#704fd9); box-shadow: 0 5px 18px rgba(76,96,210,.28); }
.build-button { display: inline-flex; align-items: center; gap: 5px; color: #dfe6ff; border-color: rgba(112,141,255,.22); background: var(--accent-soft); }
.build-button:hover { color: #fff; border-color: rgba(112,141,255,.45); }
.build-button:disabled { cursor: wait; opacity: .65; }
.danger-hover:hover { color: var(--danger); border-color: rgba(255,107,117,.2); }
.editor-body { display: grid; grid-template-columns: 210px minmax(0,1fr); min-height: 0; }
.file-sidebar { display: grid; grid-template-rows: 40px minmax(0,1fr) 27px; min-width: 0; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); background: var(--surface); }
.file-search { display: flex; align-items: center; gap: 7px; margin: 7px 8px 4px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted-2); background: var(--bg-soft); }
.file-search input { width: 100%; height: 27px; padding: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 10px; }
.file-search input::placeholder { color: var(--muted-2); }
.file-tree { min-height: 0; padding: 5px 6px 15px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.file-tree::-webkit-scrollbar { width: 8px; }.file-tree::-webkit-scrollbar-track { background: transparent; }.file-tree::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: var(--line-strong); background-clip: padding-box; }
.tree-folder > button, .tree-file { display: flex; align-items: center; width: 100%; height: 27px; padding: 0 7px; overflow: hidden; border: 0; border-radius: 6px; color: var(--muted); background: transparent; text-align: left; font-size: 10.5px; white-space: nowrap; }
.tree-folder > button:hover, .tree-file:hover { color: var(--text); background: var(--surface-3); }
.tree-file.active { color: var(--text); background: var(--accent-soft); }
.tree-folder > button::before { display: inline-grid; place-items: center; width: 13px; height: 13px; margin-right: 5px; flex: 0 0 auto; border: 1px solid var(--line-strong); border-radius: 3px; content: "−"; color: var(--muted); background: var(--bg-soft); font-family: var(--mono); font-size: 10px; font-weight: 700; line-height: 1; }
.tree-folder.collapsed > button::before { content: "+"; }
.tree-folder > button span::before { margin-right: 6px; content: "▰"; color: #8091b4; font-size: 8px; }
.tree-children { padding-left: 12px; }
.tree-folder.collapsed > .tree-children { display: none; }
.tree-file::before { display: inline-block; width: 16px; flex: 0 0 auto; color: var(--muted-2); font-family: var(--mono); font-size: 8px; content: "◇"; }
.tree-file[data-ext="tsx"]::before,.tree-file[data-ext="ts"]::before{content:"TS";color:#4fa5e8}.tree-file[data-ext="jsx"]::before,.tree-file[data-ext="js"]::before{content:"JS";color:#d9bd4b}.tree-file[data-ext="css"]::before{content:"#";color:#a96ed1}.tree-file[data-ext="json"]::before{content:"{}";color:#d2aa48}.tree-file[data-ext="php"]::before{content:"P";color:#888cc8}.tree-file[data-ext="html"]::before{content:"<>";color:#e47546}
.tree-file span { overflow: hidden; text-overflow: ellipsis; }
.tree-file.readonly { opacity: .55; }
.sidebar-foot { display: flex; justify-content: space-between; align-items: center; padding: 0 8px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 9px; }
.sidebar-foot button { border: 0; color: var(--muted); background: transparent; }
.editor-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #0c1018; }
body[data-theme="light"] .editor-stage { background: #fff; }
.editor-host { position: absolute; inset: 0; }
.editor-empty, .preview-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; padding: 30px; color: var(--muted); text-align: center; }
.editor-empty h3, .preview-empty h3 { margin: 17px 0 7px; color: var(--text); font-family: var(--display); font-size: 17px; }
.editor-empty p, .preview-empty p { max-width: 330px; margin: 0 0 20px; font-size: 12px; line-height: 1.6; }
.editor-empty > div:last-child { display: flex; gap: 8px; }
.empty-code-icon { display: grid; place-items: center; width: 62px; height: 62px; border: 1px solid var(--line-strong); border-radius: 18px; color: var(--accent); background: var(--accent-soft); font-family: var(--mono); font-size: 16px; }
.main-resizer { position: relative; z-index: 10; cursor: col-resize; background: var(--surface); }
.main-resizer:hover, .main-resizer.dragging { background: var(--accent); }
.main-resizer i { position: absolute; top: 50%; left: 1px; width: 3px; height: 28px; border-radius: 4px; background: var(--line-strong); transform: translateY(-50%); }

.preview-pane { display: grid; grid-template-rows: 41px minmax(0,1fr); }
.preview-toolbar { padding: 0 8px 0 9px; }
.preview-tabs { align-self: stretch; display: flex; gap: 2px; }
.preview-tabs button { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border: 0; color: var(--muted); background: transparent; font-size: 10px; }
.preview-tabs button.active { color: var(--text); }
.preview-tabs button.active::after { position: absolute; right: 8px; bottom: 0; left: 8px; height: 2px; border-radius: 2px 2px 0 0; content: ""; background: var(--accent); }
.preview-tabs em { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; color: var(--muted); background: var(--surface-3); font-size: 8px; font-style: normal; }
.status-dot, .ready-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(62,214,160,.5); }
.device-switch { padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); }
.device-switch button { display: grid; place-items: center; width: 24px; height: 22px; padding: 0; border: 0; border-radius: 5px; color: var(--muted-2); background: transparent; font-size: 13px; }
.device-switch button.active { color: var(--text); background: var(--surface-3); }
.preview-content { display: none; min-height: 0; overflow: auto; background: var(--bg-soft); }
.preview-content.active { display: block; }
#previewTab.active { display: grid; grid-template-rows: 35px minmax(0, 1fr); }
.preview-routebar { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 4px 7px; border-bottom: 1px solid var(--line); background: var(--surface); }
.preview-routebar > button, .preview-route-form button { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 auto; padding: 0; border: 1px solid transparent; border-radius: 6px; color: var(--muted); background: transparent; font-family: var(--mono); font-size: 13px; }
.preview-routebar > button:hover:not(:disabled), .preview-route-form button:hover { color: var(--text); border-color: var(--line); background: var(--surface-3); }
.preview-routebar > button:disabled { cursor: default; opacity: .28; }
.preview-route-form { display: flex; align-items: center; min-width: 0; height: 27px; flex: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-soft); transition: border-color .18s, box-shadow .18s; }
.preview-route-form:focus-within { border-color: rgba(112,141,255,.55); box-shadow: 0 0 0 2px var(--accent-soft); }
.preview-route-form > span { padding-left: 8px; color: var(--success); font-size: 9px; }
.preview-route-form input { width: 100%; min-width: 0; height: 100%; padding: 0 6px; border: 0; outline: 0; color: var(--text); background: transparent; font-family: var(--mono); font-size: 10px; }
.preview-route-form input::placeholder { color: var(--muted-2); }
.preview-route-form button { border-radius: 0; border-left-color: var(--line); }
.preview-canvas { position: relative; display: flex; justify-content: center; min-height: 0; overflow: auto; background-color: #080b11; background-image: linear-gradient(#ffffff07 1px,transparent 1px),linear-gradient(90deg,#ffffff07 1px,transparent 1px); background-size: 20px 20px; }
.inspector-hint { position: absolute; top: 10px; left: 50%; z-index: 5; max-width: calc(100% - 24px); padding: 7px 11px; border: 1px solid rgba(112,141,255,.42); border-radius: 8px; color: #fff; background: rgba(20,27,44,.92); box-shadow: 0 10px 28px rgba(0,0,0,.3); font-size: 9px; font-weight: 700; white-space: nowrap; pointer-events: none; transform: translateX(-50%); }
body[data-theme="light"] .preview-canvas { background-color: #dde1e8; background-image: linear-gradient(#1111110a 1px,transparent 1px),linear-gradient(90deg,#1111110a 1px,transparent 1px); }
.preview-frame { width: 100%; height: 100%; border: 0; background: white; box-shadow: 0 0 35px rgba(0,0,0,.2); transition: width .25s ease; }
.preview-frame.device-tablet { width: min(768px, 100%); }
.preview-frame.device-mobile { width: min(390px, 100%); }
.preview-shape { position: relative; width: 95px; height: 67px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 14px 35px #0004; }
.preview-shape::before { position: absolute; top: 8px; right: 8px; left: 8px; height: 5px; border-radius: 3px; content: ""; background: var(--line-strong); }
.preview-shape i { position: absolute; top: 22px; bottom: 9px; width: 21px; border-radius: 4px; background: var(--accent-soft); }.preview-shape i:nth-child(1){left:8px}.preview-shape i:nth-child(2){left:37px;width:49px}.preview-shape i:nth-child(3){display:none}
.compile-loader { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; color: var(--muted); background: rgba(8,11,17,.86); backdrop-filter: blur(8px); }
.compile-loader span { width: 36px; height: 36px; margin-bottom: 15px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }
.compile-loader b { color: var(--text); font-size: 12px; }.compile-loader small{margin-top:5px;font-size:9px}
@keyframes spin { to { transform: rotate(360deg); } }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0 0 3px; font-family: var(--display); font-size: 15px; }.panel-head p{margin:0;color:var(--muted);font-size:10px}
.panel-actions { display: flex; align-items: center; gap: 7px; }
.quick-fix-button { display: inline-flex; align-items: center; gap: 5px; color: #e5ebff; border-color: rgba(112,141,255,.34); background: var(--accent-soft); }
.quick-fix-button:hover { border-color: rgba(112,141,255,.62); background: rgba(112,141,255,.2); }
.diagnostic-list, .console-list { padding: 8px; }
.diagnostic-empty { display: grid; justify-items: center; padding: 65px 20px; color: var(--muted); text-align: center; }.diagnostic-empty b{margin-bottom:6px;color:var(--text)}.diagnostic-empty span{font-size:28px;color:var(--success);margin-bottom:12px}
.diagnostic-item { display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 7px; width: 100%; padding: 10px; border: 0; border-bottom: 1px solid var(--line); color: inherit; background: transparent; text-align: left; font-family: var(--mono); font-size: 10px; line-height: 1.5; }
.diagnostic-item .diag-icon { color: var(--warning); }.diagnostic-item.error .diag-icon{color:var(--danger)}.diagnostic-item.info .diag-icon{color:var(--accent)}
.diagnostic-item b { display: block; margin-bottom: 3px; color: var(--muted); font-weight: 500; }.diagnostic-item p{margin:0;color:var(--text)}
.console-item { display: grid; grid-template-columns: 50px minmax(0,1fr); gap: 8px; padding: 7px 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 9px; line-height: 1.5; }.console-item .level{color:var(--accent)}.console-item.error .level{color:var(--danger)}.console-item.warn .level{color:var(--warning)}.console-item pre{margin:0;white-space:pre-wrap;word-break:break-word;font:inherit;color:var(--text)}
.statusbar { display: flex; justify-content: space-between; align-items: center; padding: 0 9px; border-top: 1px solid var(--line); color: var(--muted-2); background: var(--surface); font-family: var(--mono); font-size: 8px; }
.statusbar > div { display: flex; align-items: center; gap: 12px; }.statusbar > div:first-child{gap:6px}.ready-indicator{width:5px;height:5px}.sandbox-label{color:var(--success)}

/* Modals */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(2,5,10,.68); backdrop-filter: blur(8px); animation: fadeIn .18s ease; }
.modal { position: fixed; top: 50%; left: 50%; z-index: 110; width: min(590px, calc(100% - 28px)); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); box-shadow: 0 35px 100px rgba(0,0,0,.55); transform: translate(-50%,-50%); animation: modalIn .24s cubic-bezier(.2,.8,.2,1); }
@keyframes fadeIn { from { opacity: 0; } } @keyframes modalIn { from { opacity:0; transform:translate(-50%,-47%) scale(.98); } }
.small-modal { width: min(440px, calc(100% - 28px)); }
.settings-modal { width: min(760px, calc(100% - 28px)); }
.help-modal { width: min(680px, calc(100% - 28px)); }
.admin-modal { width: min(1180px, calc(100% - 28px)); height: min(760px, calc(100vh - 30px)); overflow: hidden; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 21px 23px 17px; border-bottom: 1px solid var(--line); }
.modal-kicker { display: block; margin-bottom: 5px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.modal-head h2 { margin: 0; font-family: var(--display); font-size: 21px; letter-spacing: -.035em; }
.modal-close { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface-2); font-size: 18px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px 23px; }
#importModal .modal-body { position: relative; }
#importModal.is-importing { overflow: hidden; }
#importModal.is-importing .modal-close { position: relative; z-index: 9; color: #fff; border-color: rgba(255,107,117,.28); background: rgba(255,107,117,.12); }
.import-progress { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; min-height: 100%; padding: 28px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(7px); cursor: wait; }
.import-progress-card { display: grid; grid-template-columns: 78px minmax(0,1fr); gap: 16px; width: min(430px,100%); padding: 22px; border: 1px solid var(--line-strong); border-radius: 17px; background: var(--surface-2); box-shadow: 0 22px 60px rgba(0,0,0,.28); }
.import-progress-number { display: grid; place-content: center; width: 78px; height: 78px; border: 1px solid rgba(112,141,255,.3); border-radius: 22px; color: var(--accent); background: radial-gradient(circle at 35% 25%,rgba(112,141,255,.22),transparent 55%),var(--accent-soft); text-align: center; }
.import-progress-number strong { display: block; color: var(--text); font-family: var(--display); font-size: 22px; letter-spacing: -.04em; }
.import-progress-number span { margin-top: 2px; font-family: var(--mono); font-size: 7px; font-weight: 800; letter-spacing: .13em; }
.import-progress-copy { align-self: center; min-width: 0; }
.import-progress-copy > span { display: block; margin-bottom: 5px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.import-progress-copy h3 { margin: 0 0 5px; color: var(--text); font-family: var(--display); font-size: 17px; }
.import-progress-copy p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.import-progress-track { grid-column: 1/-1; height: 8px; overflow: hidden; border-radius: 99px; background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--line); }
.import-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#668cff,#765bea,#4ed6ae); box-shadow: 0 0 18px rgba(112,141,255,.38); transition: width .22s ease; }
.import-progress-card > small { grid-column: 1/-1; color: var(--muted-2); font-size: 8px; line-height: 1.5; text-align: center; }
body.import-locked .toast { pointer-events: none; }
.field { display: block; margin-bottom: 17px; }
.field > span, .field-title { display: block; margin-bottom: 7px; color: var(--text); font-size: 11px; font-weight: 700; }.field span small{color:var(--muted);font-weight:400}
.field input, .field select, .field textarea, #demoApiEditor { width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--text); background: var(--bg-soft); }
.field input, .field select { height: 39px; padding: 0 11px; }
.field input:focus, .field select:focus, .field textarea:focus, #demoApiEditor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-help, .form-note { margin: -2px 0 10px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.field-help code, .info-strip code, .help-steps code { color: #9db3ff; font-family: var(--mono); }
#demoApiEditor { min-height: 225px; padding: 12px; resize: vertical; font-family: var(--mono); font-size: 10px; line-height: 1.55; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.import-mode-field select { height: 46px; border-color: rgba(112,141,255,.34); background: linear-gradient(135deg,var(--accent-soft),var(--bg-soft)); font-weight: 700; }
.drop-zone { position: relative; display: grid; justify-items: center; padding: 31px 18px 24px; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--muted); background: var(--bg-soft); text-align: center; cursor: pointer; transition: .2s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 12px; border-radius: 12px; color: #a8b9ff; background: var(--accent-soft); font-size: 20px; }
.drop-zone b { color: var(--text); font-size: 13px; }.drop-zone p{margin:5px 0;color:var(--muted);font-size:11px}.drop-zone small{color:var(--muted-2);font-size:9px}.drop-zone em{display:none;margin-top:11px;padding:6px 9px;border-radius:7px;color:var(--success);background:rgba(62,214,160,.09);font-size:10px;font-style:normal}.drop-zone em.has-file{display:block}
.info-strip { display: flex; gap: 10px; align-items: flex-start; margin-top: 15px; padding: 11px 12px; border: 1px solid rgba(112,141,255,.18); border-radius: 10px; color: var(--muted); background: var(--accent-soft); font-size: 10px; line-height: 1.5; }.info-strip > span{color:var(--accent)}.info-strip p{margin:0}.info-strip b{color:var(--text)}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }.split-actions{justify-content:space-between}.split-actions>div{display:flex;gap:8px}
.help-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.help-steps article{display:flex;gap:12px;padding:15px;border:1px solid var(--line);border-radius:12px;background:var(--surface-2)}.help-steps article>b{display:grid;place-items:center;flex:0 0 auto;width:26px;height:26px;border-radius:8px;color:var(--accent);background:var(--accent-soft);font-family:var(--mono);font-size:10px}.help-steps h3{margin:2px 0 6px;font-size:12px}.help-steps p{margin:0;color:var(--muted);font-size:10px;line-height:1.55}
.prompt-message { margin: 0 0 17px; color: var(--muted); line-height: 1.65; }

/* Admin */
.admin-layout { display: grid; grid-template-columns: 160px minmax(0,1fr); height: calc(100% - 71px); min-height: 0; }
.admin-nav { padding: 12px 8px; border-right: 1px solid var(--line); background: var(--bg-soft); }
.admin-nav button { width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; text-align: left; font-size: 11px; }.admin-nav button:hover{color:var(--text);background:var(--surface-3)}.admin-nav button.active{color:var(--text);background:var(--accent-soft)}
.admin-content { min-width: 0; min-height: 0; overflow: auto; padding: 21px; }
.admin-loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 300px; color: var(--muted); }.admin-loading span{width:20px;height:20px;border:2px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:spin .7s linear infinite}
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 20px; }.stat-card{padding:16px;border:1px solid var(--line);border-radius:13px;background:var(--surface-2)}.stat-card span{display:block;color:var(--muted);font-size:9px;text-transform:uppercase;letter-spacing:.08em}.stat-card b{display:block;margin-top:8px;font-family:var(--display);font-size:25px;letter-spacing:-.04em}.stat-card small{color:var(--muted-2);font-size:9px}
.admin-section-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 12px; }.admin-section-head h3{margin:0;font-family:var(--display);font-size:16px}.admin-section-head p{margin:3px 0 0;color:var(--muted);font-size:10px}
.data-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }.data-table{width:100%;border-collapse:collapse;font-size:10px;white-space:nowrap}.data-table th{padding:9px 11px;color:var(--muted);background:var(--bg-soft);text-align:left;font-size:8px;text-transform:uppercase;letter-spacing:.07em}.data-table td{padding:9px 11px;border-top:1px solid var(--line);color:var(--muted)}.data-table td strong{color:var(--text)}.data-table select,.data-table input{height:28px;border:1px solid var(--line);border-radius:6px;color:var(--text);background:var(--bg-soft);font-size:9px}.data-table input{width:55px;padding:0 6px}.table-action{height:27px;padding:0 8px;border:1px solid var(--line);border-radius:6px;color:var(--muted);background:var(--surface-2);font-size:9px}.table-action:hover{color:var(--text)}.table-action.danger{color:var(--danger)}
.status-badge { display: inline-flex; padding: 4px 7px; border-radius: 99px; color: var(--success); background: rgba(62,214,160,.09); font-size: 8px; }.status-badge.off{color:var(--danger);background:rgba(255,107,117,.09)}
.admin-settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }.admin-settings-form .full{grid-column:1/-1}.admin-settings-form .field{margin:0}.admin-settings-actions{grid-column:1/-1;display:flex;justify-content:flex-end;margin-top:7px}
.admin-user-create { display: grid; grid-template-columns: minmax(220px,1fr) 110px 100px minmax(205px,auto) auto; gap: 9px; align-items: end; margin-bottom: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.admin-user-create .field { margin: 0; }.admin-user-create .button{height:39px}.admin-user-create-note{grid-column:1/-1;margin:0;color:var(--muted);font-size:9px;line-height:1.5}
.admin-mode-field{min-width:0;margin:0;padding:0;border:0}.admin-mode-field legend{margin-bottom:6px;color:var(--text);font-size:9px;font-weight:700}.mode-permissions{display:flex;flex-wrap:wrap;gap:6px}.mode-permissions label{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:0 8px;border:1px solid var(--line);border-radius:7px;color:var(--muted);background:var(--bg-soft);cursor:pointer;font-size:9px}.mode-permissions label:has(input:checked){border-color:rgba(112,141,255,.45);color:var(--text);background:var(--accent-soft)}.mode-permissions input{width:auto!important;height:auto!important;margin:0;accent-color:var(--accent)}.user-mode-cell{min-width:188px}
.system-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 9px; }.system-row{display:flex;justify-content:space-between;align-items:center;padding:13px;border:1px solid var(--line);border-radius:10px;color:var(--muted);background:var(--surface-2);font-size:10px}.system-row b{color:var(--text)}

.toast-stack { position: fixed; right: 17px; bottom: 37px; z-index: 300; display: grid; gap: 8px; width: min(350px, calc(100% - 34px)); pointer-events: none; }
.toast { display: grid; grid-template-columns: 24px minmax(0,1fr) 20px; align-items: flex-start; gap: 8px; padding: 11px; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--muted); background: var(--surface); box-shadow: var(--shadow); pointer-events: auto; animation: toastIn .25s ease; }.toast>span{display:grid;place-items:center;width:22px;height:22px;border-radius:7px;color:var(--success);background:rgba(62,214,160,.09)}.toast.error>span{color:var(--danger);background:rgba(255,107,117,.09)}.toast b{display:block;margin-bottom:2px;color:var(--text);font-size:10px}.toast p{margin:0;font-size:9px;line-height:1.45}.toast button{border:0;color:var(--muted);background:transparent}.toast.leaving{opacity:0;transform:translateX(20px);transition:.2s}
@keyframes toastIn{from{opacity:0;transform:translateX(18px)}}

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; gap: 45px; padding-top: 65px; }
  .login-copy { text-align: center; }.login-copy>p{margin-right:auto;margin-left:auto}.feature-row{justify-content:center}.login-card{width:min(470px,100%);margin:auto}.login-footer{margin-top:40px}
  .topbar { gap: 10px; }.topbar .brand { min-width: auto; }.topbar .brand span:last-child{display:none}.top-label,.save-state{display:none}.project-select{width:min(220px,27vw)}
  .workspace { grid-template-columns: minmax(290px, 50fr) 4px minmax(290px, 50fr); }.editor-body{grid-template-columns:175px minmax(0,1fr)}
  .editor-searchbar { width: 155px; min-width: 100px; }.editor-searchbar em{display:none}
  .stats-grid{grid-template-columns:1fr 1fr}
}

@media (max-width: 720px) {
  body { overflow: hidden; }
  .login-view { height: 100dvh; min-height: 0; }
  .login-nav,.login-shell,.login-footer{width:calc(100% - 28px)}.login-nav{padding:18px 0}.login-shell{min-height:auto;padding:65px 0 50px}.login-copy h1{font-size:48px}.login-copy>p{font-size:15px}.login-card{padding:25px}.login-footer{flex-direction:column;gap:6px}
  .app-shell { grid-template-rows: 52px 35px minmax(0,1fr) 23px; }.topbar{gap:6px;padding:0 7px}.workspace-mode-switch{padding:0 4px}.workspace-mode-label{display:none}.workspace-mode-select{min-width:78px;padding-left:5px;font-size:8px}.project-switcher-wrap{flex:1}.project-select{width:100%}.top-actions{gap:3px}.button{padding:0 8px}.hide-small{display:none!important}
  .mobile-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-bottom: 1px solid var(--line); background: var(--surface); }.mobile-mode-tabs button{border:0;border-radius:6px;color:var(--muted);background:transparent;font-size:10px}.mobile-mode-tabs button.active{color:var(--text);background:var(--surface-3)}
  .workspace { display: block; position: relative; }.work-pane{position:absolute;inset:0}.work-pane.mobile-hidden{display:none}.main-resizer{display:none}.editor-body{grid-template-columns:145px minmax(0,1fr)}
  .pane-toolbar .file-breadcrumb{display:none}.editor-searchbar{width:auto;min-width:80px;flex:1;margin-left:0}
  .statusbar>div:last-child span:not(:last-child){display:none}
  .preview-tabs button{padding:0 7px}.device-switch{display:none}
  .settings-grid,.help-steps,.admin-settings-form,.system-grid{grid-template-columns:1fr}.admin-settings-form .full,.admin-settings-actions{grid-column:auto}.admin-user-create{grid-template-columns:1fr 1fr}.admin-user-create .field:first-child,.admin-user-create-note{grid-column:1/-1}.admin-mode-field{grid-column:1/-1}.split-actions{align-items:stretch;flex-direction:column-reverse}.split-actions>div{justify-content:flex-end}
  .admin-modal{width:calc(100% - 12px);height:calc(100vh - 12px)}.admin-layout{grid-template-columns:1fr;grid-template-rows:45px minmax(0,1fr)}.admin-nav{display:flex;overflow:auto;padding:6px;border-right:0;border-bottom:1px solid var(--line)}.admin-nav button{width:auto;white-space:nowrap}.admin-content{padding:13px}.stats-grid{grid-template-columns:1fr 1fr}.modal-body{padding:18px}.modal-head{padding:18px}.modal{max-height:calc(100vh - 15px)}
}

@media (max-width: 450px) {
  .login-copy h1{font-size:41px}.feature-row{display:grid;grid-template-columns:1fr}.feature-row span{justify-content:center}.login-card{border-radius:20px}.editor-body{grid-template-columns:125px minmax(0,1fr)}.file-search{padding:0 6px}.stats-grid{grid-template-columns:1fr}.topbar .button.primary{display:none}.topbar .brand{display:none}.admin-user-create{grid-template-columns:1fr}.admin-user-create .field:first-child,.admin-user-create-note,.admin-mode-field{grid-column:auto}.import-progress{padding:16px}.import-progress-card{grid-template-columns:60px minmax(0,1fr);gap:12px;padding:16px}.import-progress-number{width:60px;height:60px;border-radius:17px}.import-progress-number strong{font-size:17px}.panel-head{align-items:flex-start;gap:10px;padding:13px}.panel-actions{flex-direction:column;align-items:stretch}.panel-actions .mini-button{width:100%}
}

/* LIVE database runtime */
.live-badge { display: inline-flex; align-items: center; gap: 6px; height: 25px; padding: 0 9px; border: 1px solid rgba(62,214,160,.28); border-radius: 999px; color: var(--success); background: rgba(62,214,160,.09); font-family: var(--mono); font-size: 8px; font-weight: 900; letter-spacing: .12em; box-shadow: 0 0 0 1px rgba(62,214,160,.03), 0 0 18px rgba(62,214,160,.08); }
.live-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 rgba(62,214,160,.45); animation: livePulse 1.8s ease-out infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(62,214,160,.48); } 65%,100% { box-shadow: 0 0 0 7px rgba(62,214,160,0); } }
.live-connect-button.active { color: var(--success); border-color: rgba(62,214,160,.32); background: rgba(62,214,160,.09); }
.sandbox-label.live { color: var(--success); font-weight: 800; }
.live-connect-modal { width: min(900px, calc(100% - 28px)); }
.live-connect-modal .modal-body { padding: 18px 22px 20px; }
.live-form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 10px; }
.live-form-grid .field { min-width: 0; margin-bottom: 12px; }
.live-form-grid .field > span { margin-bottom: 6px; }
.live-host-field { grid-column: span 6; }
.live-port-field { grid-column: span 2; }
.live-charset-field { grid-column: span 4; }
.live-db-name-field,
.live-db-user-field,
.live-password-field { grid-column: span 4; }
.live-form-grid .field > small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.live-form-grid code, .live-guide code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; color: #a9baff; background: var(--bg-soft); font-family: var(--mono); font-size: .92em; }
.password-field { display: grid; grid-template-columns: minmax(0,1fr) 39px; }
.password-field input { border-radius: 10px 0 0 10px; }
.password-field button { border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.password-field button:hover { color: var(--text); }
.live-write-toggle { display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 10px; align-items: start; margin: 2px 0 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); cursor: pointer; }
.live-write-toggle input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--accent); }
.live-write-toggle b { display: block; margin-bottom: 3px; color: var(--text); font-size: 10px; }
.live-write-toggle small { display: block; color: var(--muted); font-size: 9px; line-height: 1.45; }
.live-connection-result { margin: 0 0 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--surface-2); font-size: 10px; line-height: 1.55; }
.live-connection-result.success { color: #9ce9cc; border-color: rgba(62,214,160,.26); background: rgba(62,214,160,.08); }
.live-connection-result.error { color: #ffb1b8; border-color: rgba(255,107,117,.28); background: rgba(255,107,117,.08); }
.live-connection-result.testing { color: #b9c6ff; border-color: rgba(112,141,255,.28); background: var(--accent-soft); }
.live-guide { margin: 0 0 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--bg-soft); }
.live-guide summary { padding: 13px 15px; color: var(--text); background: var(--surface-2); cursor: pointer; font-size: 11px; font-weight: 850; letter-spacing: .015em; line-height: 1.4; user-select: none; }
.live-guide > div { padding: 4px 16px 16px; color: var(--muted); font-size: 10.5px; line-height: 1.72; }
.live-guide ol { margin: 12px 0 12px; padding-left: 21px; }
.live-guide li { margin: 7px 0; padding-left: 2px; }
.live-guide p { margin: 10px 0 0; }
.live-guide b { color: var(--text); }
.live-connect-modal .modal-actions > div { display: flex; gap: 8px; }

@media (max-width: 720px) {
  .live-badge { padding: 0 7px; font-size: 7px; }
  .live-host-field,
  .live-password-field { grid-column: 1 / -1; }
  .live-port-field { grid-column: span 4; }
  .live-charset-field { grid-column: span 8; }
  .live-db-name-field,
  .live-db-user-field { grid-column: span 6; }
  .live-connect-modal .modal-actions { align-items: stretch; flex-direction: column-reverse; }
  .live-connect-modal .modal-actions > div { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 450px) {
  .live-badge { height: 23px; }
  .live-connect-button .button-icon { margin: 0; }
  .live-form-grid { grid-template-columns: 1fr; }
  .live-host-field,
  .live-port-field,
  .live-charset-field,
  .live-db-name-field,
  .live-db-user-field,
  .live-password-field { grid-column: 1; }
  .live-connect-modal .modal-actions > div { grid-template-columns: 1fr; }
}
.live-connection-result { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 9px; align-items: start; }
.live-connection-result > span { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-weight: 900; }
.live-connection-result.success > span { color: var(--success); background: rgba(62,214,160,.12); }
.live-connection-result.error > span { color: var(--danger); background: rgba(255,107,117,.12); }
.live-connection-result b { display: block; margin: 1px 0 2px; color: var(--text); font-size: 10px; }
.live-connection-result p { margin: 0; color: inherit; font-size: 9px; }

/* UI compact header update — based on LIVE 1.5.2 */
.boot-mark,
.brand-mark,
.mini-logo {
  overflow: hidden;
  padding: 0;
}
.boot-mark img,
.brand-mark img,
.mini-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-menu-wrap {
  position: relative;
  flex: 0 0 auto;
}
.header-menu-button {
  min-width: 102px;
}
.header-menu-button .menu-chevron {
  margin-left: 1px;
  color: var(--muted-2);
  font-size: 11px;
  transition: transform .18s ease;
}
.header-menu-button[aria-expanded="true"] .menu-chevron {
  transform: rotate(180deg);
}
.header-actions-dropdown {
  top: 43px;
  right: 0;
  min-width: 254px;
}
.dropdown-label {
  display: block;
  padding: 5px 10px 7px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .12em;
}
.header-actions-dropdown .dropdown-item {
  align-items: flex-start;
  padding-top: 10px;
  padding-bottom: 10px;
}
.header-actions-dropdown .dropdown-item > span:last-child {
  min-width: 0;
}
.header-actions-dropdown .dropdown-item b,
.header-actions-dropdown .dropdown-item small {
  display: block;
}
.header-actions-dropdown .dropdown-item b {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}
.header-actions-dropdown .dropdown-item small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 8px;
  line-height: 1.4;
}
.menu-item-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  margin-top: 1px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #b8c5ff;
  background: var(--accent-soft);
  font-size: 12px;
}
.dropdown-item:disabled {
  cursor: default;
  opacity: .42;
}
.dropdown-item:disabled:hover {
  color: var(--muted);
  background: transparent;
}
.restore-menu-item:not(:disabled) {
  color: #cdd8ff;
}

.editor-body {
  transition: grid-template-columns .18s ease;
}
.file-sidebar {
  grid-template-rows: 42px minmax(0,1fr) 27px;
  transition: opacity .16s ease, visibility .16s ease;
}
.file-sidebar-head {
  display: flex;
  align-items: stretch;
  min-width: 0;
}
.file-sidebar-head .file-search {
  flex: 1 1 auto;
  min-width: 0;
  margin: 7px 0 4px 8px;
}
.file-sidebar-toggle,
.file-sidebar-show {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--bg-soft);
  transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}
.file-sidebar-toggle {
  flex: 0 0 auto;
  margin: 7px 8px 4px 5px;
}
.project-merge-trigger {
  margin-right: 0;
  color: #aebdff;
}
.project-merge-trigger:not(:disabled):hover {
  color: #d7dfff;
  border-color: rgba(112,141,255,.42);
  background: var(--accent-soft);
}
.file-sidebar-toggle:disabled {
  cursor: default;
  opacity: .38;
  transform: none;
}
.file-sidebar-toggle:not(:disabled):hover,
.file-sidebar-show:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-3);
  transform: translateY(-1px);
}
.file-sidebar-toggle svg,
.file-sidebar-show svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.file-sidebar-toggle .eye-slash {
  stroke: var(--danger);
  stroke-width: 1.6;
}
.file-sidebar-show {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 12;
  width: 31px;
  height: 31px;
  border-color: rgba(112,141,255,.28);
  color: #c9d4ff;
  background: rgba(17,22,32,.92);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  backdrop-filter: blur(10px);
}

.project-merge-modal { width: min(670px, calc(100% - 28px)); }
.project-merge-modal .modal-body { position: relative; }
.project-merge-file-card { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-soft); }
.project-merge-file-icon { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(112,141,255,.24); border-radius: 14px; color: #b7c4ff; background: var(--accent-soft); font-size: 22px; }
.project-merge-file-card > div { min-width: 0; }
.project-merge-file-card small { display: block; margin-bottom: 4px; color: var(--accent); font-family: var(--mono); font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.project-merge-file-card b { display: block; overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.project-merge-file-card p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.project-merge-file-card .button { height: 34px; white-space: nowrap; }
.project-merge-rules { display: grid; gap: 8px; margin-top: 13px; }
.project-merge-rules article { display: grid; grid-template-columns: 27px minmax(0,1fr); gap: 10px; align-items: start; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.project-merge-rules article > span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-family: var(--mono); font-size: 9px; font-weight: 900; }
.project-merge-rules b { display: block; margin: 1px 0 3px; color: var(--text); font-size: 10px; }
.project-merge-rules p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.project-merge-rules code { color: #a9baff; font-family: var(--mono); }
.project-merge-result { margin-top: 13px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--surface-2); font-size: 10px; line-height: 1.5; }
.project-merge-result.success { color: #9ce9cc; border-color: rgba(62,214,160,.26); background: rgba(62,214,160,.08); }
.project-merge-result.warning { color: #ffd89c; border-color: rgba(255,178,74,.28); background: rgba(255,178,74,.08); }
.project-merge-result.error { color: #ffb1b8; border-color: rgba(255,107,117,.28); background: rgba(255,107,117,.08); }

@media (max-width: 600px) {
  .project-merge-file-card { grid-template-columns: 43px minmax(0,1fr); }
  .project-merge-file-icon { width: 43px; height: 43px; }
  .project-merge-file-card .button { grid-column: 1 / -1; width: 100%; }
}
body[data-theme="light"] .file-sidebar-show {
  background: rgba(255,255,255,.94);
}
.editor-body.files-collapsed {
  grid-template-columns: 0 minmax(0,1fr) !important;
}
.editor-body.files-collapsed .file-sidebar {
  visibility: hidden;
  overflow: hidden;
  border-right: 0;
  opacity: 0;
  pointer-events: none;
}
.sidebar-foot {
  justify-content: flex-start;
}

@media (max-width: 720px) {
  .header-menu-button {
    min-width: 35px;
    padding-right: 7px;
    padding-left: 7px;
  }
  .header-menu-button .menu-chevron {
    display: none;
  }
  .header-actions-dropdown {
    right: -42px;
    width: min(254px, calc(100vw - 18px));
  }
}
