/* ============================================================
   CodeDrop — redesigned UI
   Mobile-first. One set of tokens drives the UI *and* the editor theme.
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0e13;
  --surface: #12171e;
  --surface-2: #19202a;
  --surface-3: #222b37;
  --border: #27303c;
  --text: #e8edf4;
  --text-dim: #8c98a9;
  --text-faint: #5d6978;
  --accent: #0096cc;
  --accent-2: #0076ff;
  --accent-soft: rgba(90, 162, 255, 0.14);
  --green: #3ddc97;
  --red: #ff6b7a;
  --yellow: #f5c451;
  --code-bg: #0d1117;
  --sel: rgba(90, 162, 255, 0.28);
  --active-line: rgba(255, 255, 255, 0.045);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);

  /* syntax */
  --syn-keyword: #ff7b8f;
  --syn-string: #9fd6ff;
  --syn-number: #79c0ff;
  --syn-comment: #7d8a99;
  --syn-def: #d2a8ff;
  --syn-type: #ffb86b;
  --syn-tag: #7ee0a0;
  --syn-attr: #79c0ff;
  --syn-meta: #ffb86b;
  --syn-builtin: #e6c07b;
  --syn-op: #c9d1d9;

  --editor-font: 'JetBrains Mono', 'Fira Code', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ui-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --editor-font-size: 14px;
  --radius: 14px;
  --radius-sm: 9px;
  --safe-top: 5px;
  --safe-bottom: 5px;
}

.light-theme {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --surface-3: #e3e8f0;
  --border: #d8dee8;
  --text: #17202b;
  --text-dim: #586478;
  --text-faint: #8995a8;
  --accent: #1769e0;
  --accent-2: #6a4df0;
  --accent-soft: rgba(23, 105, 224, 0.1);
  --green: #12a36a;
  --red: #d93a4b;
  --yellow: #b7860b;
  --code-bg: #fbfcfe;
  --sel: rgba(23, 105, 224, 0.2);
  --active-line: rgba(23, 32, 43, 0.045);
  --shadow: 0 10px 30px rgba(20, 30, 50, 0.16);

  --syn-keyword: #cf222e;
  --syn-string: #0a3069;
  --syn-number: #0550ae;
  --syn-comment: #6e7781;
  --syn-def: #8250df;
  --syn-type: #953800;
  --syn-tag: #116329;
  --syn-attr: #0550ae;
  --syn-meta: #953800;
  --syn-builtin: #7d4e00;
  --syn-op: #24292f;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--ui-font);
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  font-size: 14px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

button, input, select, textarea { font-family: inherit; }
button { -webkit-appearance: none; appearance: none; }

.app {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
  overflow: hidden; position: relative;
  background: var(--bg);
}

/* ============ Top bar ============ */
.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  min-height: calc(54px + var(--safe-top));
  flex-shrink: 0; z-index: 20;
}
.brand {
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.title-block { flex: 1; min-width: 0; line-height: 1.2; }
.title-block .title { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-block .subtitle { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.run-btn {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px; border: none; border-radius: 5px;
  background: var(--accent);
  color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.run-btn i { font-size: 11px; }
.run-btn:active { opacity: 0.85; transform: scale(0.97); }

.icon-btn {
  background: transparent; border: none; color: var(--text-dim);
  font-size: 16px; width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.icon-btn.sm { width: 32px; height: 32px; font-size: 13px; }
.icon-btn:active, .icon-btn:hover { background: var(--surface-2); color: var(--text); }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 14px;
  font-size: 11px; color: var(--text-dim);
  max-width: 112px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex-shrink: 1;
}
.status-pill #appStatusText { overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.status-dot.idle { background: var(--text-faint); }
.status-dot.busy { background: var(--yellow); animation: pulse 1s infinite; }
.status-dot.ok { background: var(--green); }
.status-dot.error { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ============ Screens ============ */
.screen-container { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg); overflow: hidden;
  opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 1;
  min-height: 0;
}
.screen.active { opacity: 1; pointer-events: auto; z-index: 2; }

/* ============ Bottom nav ============ */
.bottom-nav {
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
  height: calc(58px + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  flex-shrink: 0; z-index: 20;
}
.nav-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: transparent; border: none; color: var(--text-dim);
  font-size: 10.5px; font-weight: 500; flex: 1; cursor: pointer;
}
.nav-item i { font-size: 18px; }
.nav-item.active { color: var(--accent); }
.nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 28%; right: 28%;
  height: 3px; border-radius: 0 0 4px 4px; background: var(--accent);
}
.nav-item:active { background: var(--surface-2); }
.app.kb-open .bottom-nav { display: none; }
.app.kb-open .top-bar { min-height: calc(46px + var(--safe-top)); }

/* ============ Home ============ */
.home-content { flex: 1; overflow-y: auto; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 20px; }
.hero h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.hero p { margin-top: 4px; color: var(--text-dim); font-size: 13.5px; line-height: 1.4; }

.quick-actions { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.qa {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px;
  min-height: 84px; padding: 12px 13px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
}
.qa i { font-size: 18px; color: var(--accent); }
.qa.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.qa.primary i { color: #fff; }
.qa:active { transform: scale(0.98); opacity: 0.9; }

.section-title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 10px; }

.project-card {
  display: flex; align-items: center; gap: 13px;
  border-bottom: 1px solid var(--border);
  padding: 13px 12px 13px 13px; margin-bottom: 10px; cursor: pointer;
}
.project-card:active { background: var(--surface-2); }
.project-avatar {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; color: #fff;
}
.project-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.project-title { font-size: 15.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-pkg { font-family: var(--editor-font); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-3); color: var(--text-dim); border-radius: 10px; padding: 2px 8px; font-size: 11px; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.chip.ok .dot { background: var(--green); }
.chip.bad .dot { background: var(--red); }
.chip.run .dot { background: var(--yellow); }
.card-menu { align-self: flex-start; }

.badge { background: var(--surface-3); padding: 2px 8px; border-radius: 12px; font-size: 11px; color: var(--text-dim); }

.empty-state { display: none; flex-direction: column; align-items: center; justify-content: center; padding: 34px 20px; text-align: center; color: var(--text-dim); gap: 8px; }
.empty-state h3 { color: var(--text); font-size: 17px; }
.empty-state p { font-size: 13.5px; line-height: 1.5; max-width: 270px; }
.empty-art { width: 76px; height: 76px; border-radius: 24px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 32px; margin-bottom: 6px; }

/* ============ Buttons ============ */
.btn {
  background: var(--accent); border: none; color: #fff;
  padding: 12px 20px; border-radius: 5px; font-weight: 600; font-size: 14.5px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
}
.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--surface-3); color: var(--text); }
.btn.outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 8px 14px; font-size: 13px; min-height: 38px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ Editor: tabs ============ */
.editor-tabs {
  display: flex; gap: 2px; align-items: flex-end;
  background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0; height: 40px; padding: 0 6px;
  scrollbar-width: none;
}
.editor-tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 7px; padding: 0 8px 0 12px; height: 34px;
  border-radius: 10px 10px 0 0; font-size: 12.5px; white-space: nowrap;
  color: var(--text-dim); background: transparent; cursor: pointer; flex-shrink: 0;
}
.tab.active { color: var(--text); background: var(--code-bg); box-shadow: inset 0 -2px 0 var(--accent); }
.tab i.file-ic { font-size: 12px; color: var(--accent); }
.tab .close-tab { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 11px; opacity: 0.7; }
.tab .close-tab:active { background: var(--surface-3); }

/* ============ Editor: find bar ============ */
.find-bar { display: none; flex-direction: column; gap: 6px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 10px; }
.find-bar.active { display: flex; }
.find-row { display: flex; align-items: center; gap: 6px; }
.find-row input {
  flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 10px; color: var(--text); font-size: 14px; outline: none; height: 36px;
}
.find-row input:focus { border-color: var(--accent); }
.find-count { font-size: 11px; color: var(--text-dim); min-width: 44px; text-align: right; white-space: nowrap; }
.chip-btn {
  height: 34px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-dim); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip-btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip-btn.strong { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-btn:active { opacity: 0.8; }

/* ============ Editor host ============ */
.editor-host { flex: 1; min-height: 0; position: relative; background: var(--code-bg); overflow: hidden; }
.editor-empty {
  position: absolute; inset: 0; z-index: 5;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--text-dim); background: var(--code-bg);
}
.editor-empty i { font-size: 38px; opacity: 0.35; }
.editor-host.empty .editor-empty { display: flex; }

/* extra keys row */
.extra-keys {
  display: flex; gap: 5px; padding: 6px 8px; overflow-x: auto; flex-shrink: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.extra-keys::-webkit-scrollbar { display: none; }
.xk {
  flex-shrink: 0; min-width: 36px; height: 36px; padding: 0 9px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; font-family: var(--editor-font); font-size: 15px; font-weight: 500; cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.xk.wide { padding: 0 14px; font-family: var(--ui-font); font-size: 12.5px; font-weight: 600; color: var(--accent); }
.xk:active { background: var(--accent-soft); border-color: var(--accent); }

/* toolbar */
.editor-toolbar {
  display: flex; align-items: center; gap: 4px; padding: 3px 6px; overflow-x: auto;
  background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0; height: 46px;
  scrollbar-width: none;
}
.editor-toolbar::-webkit-scrollbar { display: none; }
.tb-group { display: flex; align-items: center; gap: 1px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--border); flex-shrink: 0; }
.tb-group:last-child { border-right: none; }
.editor-toolbar .icon-btn { width: 38px; height: 38px; font-size: 15px; }
.editor-toolbar .icon-btn.on { color: var(--accent); }

/* status bar */
.status-bar {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  height: 24px; padding: 0 12px; background: var(--surface-2); border-top: 1px solid var(--border);
  font-family: var(--editor-font); font-size: 10.5px; color: var(--text-dim); white-space: nowrap;
}
.sb-spacer { flex: 1; }
.sb-save i { color: var(--green); margin-right: 3px; }
.sb-save.dirty i { color: var(--yellow); }
.app.kb-open .status-bar { display: none; }

/* ============ CodeMirror theme ============ */
.CodeMirror {
  height: 100%; background: var(--code-bg); color: var(--text);
  font-family: var(--editor-font); font-size: var(--editor-font-size); line-height: 1.55;
  font-variant-ligatures: none;
}
.CodeMirror-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: 40px; }
.CodeMirror-lines { padding: 8px 0 60px; }
.CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like { padding: 0 6px; }
.CodeMirror-gutters { background: var(--code-bg); border-right: 1px solid var(--border); }
.CodeMirror-linenumber { color: var(--text-faint); padding: 0 8px 0 4px; font-size: 0.82em; }
.CodeMirror-activeline-background { background: var(--active-line); }
.CodeMirror-activeline .CodeMirror-linenumber, .CodeMirror-linenumber.active { color: var(--text); }
.CodeMirror-cursor { border-left: 2px solid var(--accent); }
.CodeMirror-selected { background: var(--sel); }
.CodeMirror-focused .CodeMirror-selected { background: var(--sel); }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: var(--sel); }
.CodeMirror-matchingbracket { color: inherit !important; background: var(--accent-soft); outline: 1px solid var(--accent); border-radius: 2px; }
.CodeMirror-nonmatchingbracket { color: var(--red) !important; }
.CodeMirror-foldmarker { color: var(--accent); text-shadow: none; font-family: inherit; }
.CodeMirror-foldgutter { width: 14px; }
.CodeMirror-foldgutter-open:after, .CodeMirror-foldgutter-folded:after { color: var(--text-faint); font-size: 12px; }
.cm-searching { background: rgba(245, 196, 81, 0.35); border-radius: 2px; }

.cm-s-default .cm-keyword, .cm-keyword { color: var(--syn-keyword); }
.cm-s-default .cm-atom, .cm-atom { color: var(--syn-number); }
.cm-s-default .cm-number, .cm-number { color: var(--syn-number); }
.cm-s-default .cm-def, .cm-def { color: var(--syn-def); }
.cm-s-default .cm-variable, .cm-variable { color: var(--text); }
.cm-s-default .cm-variable-2, .cm-variable-2 { color: var(--text); }
.cm-s-default .cm-variable-3, .cm-s-default .cm-type, .cm-variable-3, .cm-type { color: var(--syn-type); }
.cm-s-default .cm-property, .cm-property { color: var(--text); }
.cm-s-default .cm-operator, .cm-operator { color: var(--syn-op); }
.cm-s-default .cm-comment, .cm-comment { color: var(--syn-comment); font-style: italic; }
.cm-s-default .cm-string, .cm-string { color: var(--syn-string); }
.cm-s-default .cm-string-2, .cm-string-2 { color: var(--syn-string); }
.cm-s-default .cm-meta, .cm-meta { color: var(--syn-meta); }
.cm-s-default .cm-builtin, .cm-builtin { color: var(--syn-builtin); }
.cm-s-default .cm-qualifier, .cm-qualifier { color: var(--syn-type); }
.cm-s-default .cm-bracket, .cm-bracket { color: var(--text-dim); }
.cm-s-default .cm-tag, .cm-tag { color: var(--syn-tag); }
.cm-s-default .cm-attribute, .cm-attribute { color: var(--syn-attr); }
.cm-s-default .cm-header, .cm-header { color: var(--syn-def); font-weight: 700; }
.cm-s-default .cm-link, .cm-link { color: var(--accent); }
.cm-s-default .cm-error, .cm-error { color: #fff; background: var(--red); }
.cm-s-default .cm-hr, .cm-hr { color: var(--syn-comment); }
.cm-strong { font-weight: 700; }
.cm-em { font-style: italic; }

.CodeMirror-hints {
  z-index: 400; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); font-family: var(--editor-font); font-size: 13px; padding: 4px; max-height: 15em;
}
li.CodeMirror-hint { color: var(--text); padding: 7px 10px; border-radius: 8px; }
li.CodeMirror-hint-active { background: var(--accent); color: #fff; }

/* ============ Drawer (file tree) ============ */
.sheet-backdrop, .drawer-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); display: none; backdrop-filter: blur(2px); }
.sheet-backdrop { z-index: 90; }
.drawer-overlay { z-index: 50; }
.sheet-backdrop.open, .drawer-overlay.open { display: block; }
.project-drawer {
  position: absolute; top: 0; left: -320px; width: 300px; max-width: 86%; height: 100%;
  background: var(--surface); border-right: 1px solid var(--border); z-index: 60;
  display: flex; flex-direction: column; transition: left 0.1s ease; box-shadow: var(--shadow);
  padding-top: var(--safe-top);
}
.project-drawer.open { left: 0; }
.drawer-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-weight: 650; font-size: 15px; }
.drawer-tree { flex: 1; overflow-y: auto; padding: 8px 0; }
.drawer-footer { padding: 10px 12px calc(10px + var(--safe-bottom)); border-top: 1px solid var(--border); display: flex; gap: 8px; }
.drawer-footer .btn { flex: 1; border: none;}

.tree-row { display: flex; align-items: center; gap: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer; color: var(--text); user-select: none; }
.tree-row:active { background: var(--surface-2); }
.tree-row.selected { background: var(--accent-soft); }
.tree-row .chevron { width: 14px; text-align: center; color: var(--text-dim); font-size: 10px; }
.tree-row .tree-icon { width: 18px; text-align: center; font-size: 14px; }
.tree-row .folder-icon { color: #e5c07b; }
.tree-row .file-icon { color: var(--accent); }
.tree-row .file-icon.binary { color: var(--text-dim); opacity: 0.7; }
.tree-children { display: none; }
.tree-children.expanded { display: block; }

/* ============ Bottom sheets ============ */
.build-panel, .signing-panel, .file-actions-panel, .artifacts-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 22px 22px 0 0; z-index: 100;
  display: flex; flex-direction: column;
  transform: translateY(105%); transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.24s;
  max-height: 88%;
  padding-bottom: var(--safe-bottom);
  visibility: hidden;
}
.build-panel.open, .signing-panel.open, .file-actions-panel.open, .artifacts-panel.open {
  transform: translateY(0); visibility: visible; transition-delay: 0s; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.4);
}
.grabber { width: 38px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 8px auto 0; flex-shrink: 0; }
.sheet-title { padding: 12px 20px 6px; font-weight: 650; font-size: 15px; }

.build-header, .signing-header, .artifacts-header {
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
  font-weight: 650; font-size: 15px; flex-shrink: 0;
}
.build-header .icon-btn { width: 36px; height: 36px; font-size: 15px; }

.build-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 14px 10px; }
.build-actions .btn { padding: 8px 8px; font-size: 12.5px; min-height: 42px; border-radius: 4px;}
.build-actions #cancelBuildBtn { grid-column: 1 / -1; min-height: 36px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 2px 16px 10px; font-size: 13px; color: var(--text); cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }
.check-row small { color: var(--text-dim); }

.build-progress { padding: 4px 16px 6px; display: flex; flex-direction: column; gap: 6px; }
.progress-bar { height: 7px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.3s; border-radius: 4px; }
.build-status { font-size: 12px; color: var(--text-dim); display: flex; justify-content: space-between; }
.build-phase { font-size: 12px; color: var(--text-dim); min-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--editor-font); }

.terminal {
  background: #080b10; border-radius: 12px; margin: 6px 12px 12px; padding: 12px;
  font-family: var(--editor-font); font-size: 11.5px; line-height: 1.5; color: #b6beca;
  overflow-y: auto; border: 1px solid var(--border); flex: 1; min-height: 140px; max-height: 46vh;
  word-break: break-word; white-space: pre-wrap;
}
.terminal .log-success { color: #7ee0a0; }
.terminal .log-error { color: #ff7b8f; }
.terminal .log-info { color: #7cb7ff; }
.terminal .log-warn { color: #f1c76b; }
.terminal .log-dim { color: #6b7480; }

/* ============ Signing ============ */
.signing-body { padding: 4px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.field-group input, .field-group select {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 12px; color: var(--text); font-size: 14px; outline: none; min-height: 44px;
}
.field-group input:focus, .field-group select:focus { border-color: var(--accent); }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 500; }
.status-chip.success { background: rgba(61, 220, 151, 0.15); color: var(--green); }
.status-chip.error { background: rgba(255, 107, 122, 0.15); color: var(--red); }
.status-chip.pending { background: rgba(245, 196, 81, 0.15); color: var(--yellow); }
.sign-progress { display: flex; flex-direction: column; gap: 6px; }
.sign-live { font-family: var(--editor-font); font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 14px; }
.verify-result { flex-direction: column; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.verify-row { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.verify-label { font-size: 10.5px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.verify-value { color: var(--text); word-break: break-all; }
.verify-row.mono .verify-value { font-family: var(--editor-font); font-size: 11px; }
.verify-row.ok .verify-value { color: var(--green); font-weight: 600; }
.verify-row.bad .verify-value { color: var(--red); font-weight: 600; }
.verify-row.dim .verify-value { color: var(--text-dim); }

/* ============ Artifacts ============ */
.artifacts-tabs { display: flex; gap: 6px; padding: 0 14px 8px; flex-shrink: 0; }
.artifacts-tab {
  flex: 1; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 11px;
}
.artifacts-tab.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.artifacts-list, .builds-list { flex: 1; overflow-y: auto; padding: 4px 14px 20px; }
.artifact-item, .build-item {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
  padding: 11px 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px;
}
.artifact-item .artifact-icon, .build-item .artifact-icon { font-size: 19px; color: var(--accent); width: 26px; text-align: center; flex-shrink: 0; }
.artifact-item .artifact-icon.keystore { color: var(--yellow); }
.artifact-item .artifact-icon.apk, .artifact-item .artifact-icon.signed-apk { color: var(--green); }
.artifact-item .artifact-icon.aab, .artifact-item .artifact-icon.signed-aab { color: var(--accent); }
.artifact-item .artifact-icon.logs { color: var(--text-dim); }
.artifact-body { flex: 1; min-width: 0; }
.artifact-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-meta { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.artifact-actions { display: flex; gap: 2px; flex-shrink: 0; }
.artifact-item .icon-btn, .build-item .icon-btn { width: 34px; height: 34px; font-size: 14px; }
.build-item.status-cancelled .artifact-name { color: var(--yellow); }
.empty-list { padding: 30px 20px; text-align: center; color: var(--text-dim); font-size: 13px; }

/* ============ File actions + settings ============ */
.file-actions-panel { padding-bottom: calc(14px + var(--safe-bottom)); overflow-y: auto; max-height: 72%; }
.action-item { display: flex; align-items: center; gap: 14px; padding: 13px 22px; font-size: 15px; cursor: pointer; color: var(--text); min-height: 50px; }
.action-item:active { background: var(--surface-2); }
.action-item i { width: 22px; color: var(--text-dim); font-size: 17px; text-align: center; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 22px; cursor: pointer; }
.setting-name { font-size: 14.5px; font-weight: 500; }
.setting-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.stepper { display: flex; gap: 6px; }
.stepper .icon-btn { background: var(--surface-2); border: 1px solid var(--border); }
.switch { -webkit-appearance: none; appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--surface-3); position: relative; transition: background 0.15s; flex-shrink: 0; outline: none; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

/* ============ Modal ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); width: 100%; max-width: 400px; padding: 20px 18px 14px; display: flex; flex-direction: column; gap: 14px; animation: modalIn 0.16s ease; }
@keyframes modalIn { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-title { font-size: 17px; font-weight: 650; color: var(--text); }
.modal-body { display: flex; flex-direction: column; gap: 10px; }
.modal-body input { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; color: var(--text); font-size: 14px; outline: none; min-height: 44px; width: 100%; }
.modal-body input:focus { border-color: var(--accent); }
.modal-text { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ============ Misc ============ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

@media (min-width: 700px) {
  .app { max-width: 820px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); box-shadow: 0 0 40px rgba(0, 0, 0, 0.4); }
  body { background: #06080c; }
}
@media (max-width: 380px) {
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .quick-actions .primary { grid-column: 1 / -1; min-height: 64px; }
  .status-pill { max-width: 84px; }
}

/* ---- actions panel: hideable items with a hint of what they act on ---- */
.action-item[hidden] { display: none; }
.action-item .action-label { flex: 1; min-width: 0; }
.action-item .action-sub { margin-left: auto; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-faint); font-family: var(--editor-font); }
