/* gridosa.css — GridOSA v1-10 */
/* Big North LLC — gridosa.com */

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

/* ── Tokens ────────────────────────────────────────── */
:root {
  --sidebar-w:    52px;
  --sidebar-expanded-w: 200px;
  --sidebar-collapsed-w: 52px;
  --settings-w:  300px;
  --pane-w:       480px;
  --topbar-h:     52px;
  --tile-size:    calc(var(--icon-size, 40px) + 48px);
  --gap:          var(--grid-gap, 10px);
  --radius-tile:  10px;
  --radius-sm:    7px;
  --radius-md:    10px;
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-disp:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --trans:        0.18s ease;
}

/* ── Dark theme (default) ─────────────────────────── */
[data-theme="dark"] {
  --bg:           #080a0f;
  --surface:      #0d1018;
  --sidebar-bg:   #0b0d14;
  --tile-bg:      #111520;
  --tile-hover:   #161d2a;
  --border:       rgba(255,255,255,0.07);
  --border-med:   rgba(255,255,255,0.12);
  --text:         #dce4f0;
  --text-dim:     #4a5568;
  --text-mid:     #7a8898;
  --accent:       #4af0b4;
  --accent-dim:   #1a5e42;
  --accent-glow:  rgba(74,240,180,0.14);
  --settings-bg:  #0b0e18;
  --input-bg:     #141824;
  --scrollbar:    rgba(255,255,255,0.08);
  --grid-line:    rgba(255,255,255,0.025);
  --drag-ghost:   rgba(74,240,180,0.08);
  --drag-border:  rgba(74,240,180,0.3);
}

/* ── Light theme ──────────────────────────────────── */
[data-theme="light"] {
  --bg:           #f0f2f6;
  --surface:      #ffffff;
  --sidebar-bg:   #ffffff;
  --tile-bg:      #ffffff;
  --tile-hover:   #f5f7fc;
  --border:       rgba(0,0,0,0.08);
  --border-med:   rgba(0,0,0,0.14);
  --text:         #1a2030;
  --text-dim:     #a0aab8;
  --text-mid:     #6a7888;
  --accent:       #0a8060;
  --accent-dim:   #c5ede2;
  --accent-glow:  rgba(10,128,96,0.10);
  --settings-bg:  #f8fafd;
  --input-bg:     #f0f4f8;
  --scrollbar:    rgba(0,0,0,0.1);
  --grid-line:    rgba(0,0,0,0.04);
  --drag-ghost:   rgba(10,128,96,0.06);
  --drag-border:  rgba(10,128,96,0.35);
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width:100%; height:100%; overflow:hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  transition: background var(--trans), color var(--trans);
}

/* ── Shell layout ──────────────────────────────────── */
#shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}
/* topbar + body row */
#shell > #topbar { flex-shrink: 0; }
#shell-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Top bar ───────────────────────────────────────── */
#topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px 0 0;
  z-index: 50;
  height: var(--topbar-h);
  flex-shrink: 0;
}
#topbar-logo {
  width: var(--sidebar-w);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  overflow: visible;
  transition: width 0.22s cubic-bezier(.4,0,.2,1);
}
#topbar-logo svg { width:22px; height:22px; flex-shrink:0; }
#topbar-wordmark {
  display: none; /* hidden in icon-strip mode; shown when expanded */
}
#sidebar.expanded ~ * #topbar-wordmark,
#shell.sidebar-expanded #topbar-wordmark {
  display: block;
}

/* collapse toggle button — now a tab on sidebar edge, not in topbar */
#sidebar-collapse-btn { /* styles in sidebar section above */ }

#search-wrap {
  flex: 1;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color var(--trans);
}
#search-wrap:focus-within { border-color: var(--accent); }
#search-wrap svg { width:13px; height:13px; flex-shrink:0; opacity:.5; }
#search {
  background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-ui); font-size:12px;
  width: 100%; height: 34px;
}
#search::placeholder { color: var(--text-dim); }
#topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
#clock {
  font-size: 11px;
  color: var(--text-mid);
  letter-spacing: 0.06em;
}
/* theme toggle */
#theme-btn {
  width: 42px; height: 24px;
  background: var(--input-bg);
  border: 1px solid var(--border-med);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: background var(--trans);
  flex-shrink: 0;
}
#theme-btn::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1);
}
[data-theme="light"] #theme-btn::after { transform: translateX(18px); }
/* gear btn */
#gear-btn {
  width: 34px; height: 34px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-mid);
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}
#gear-btn:hover { background: var(--tile-hover); color: var(--accent); border-color: var(--accent); }
#gear-btn svg { width:16px; height:16px; }
#gear-btn.active { background: var(--accent-glow); color: var(--accent); border-color: var(--accent); }

/* ── Sidebar ───────────────────────────────────────── */

#sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: visible;           /* allow tab to bleed outside */
  width: var(--sidebar-w);
  transition: width 0.22s cubic-bezier(.4,0,.2,1);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

/* expanded state */
#sidebar.expanded {
  width: var(--sidebar-expanded-w);
}

/* ── Vertical collapse/expand tab ─────────────────── */
/* A tall pill on the right edge, centered vertically   */
#sidebar-collapse-btn {
  position: absolute;
  right: -14px;               /* half outside the sidebar edge */
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 56px;
  background: var(--sidebar-bg);
  border: 1px solid var(--border-med);
  border-left: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  z-index: 30;
  transition: background var(--trans), color var(--trans), width var(--trans);
  padding: 0;
}
#sidebar-collapse-btn:hover {
  background: var(--tile-hover);
  color: var(--accent);
  width: 18px;
}
/* chevron inside the tab */
#sidebar-collapse-btn svg {
  width: 8px; height: 8px;
  display: block;
  transition: transform 0.22s;
  flex-shrink: 0;
}
/* expanded: chevron points left (collapse); collapsed: points right (expand) */
#sidebar.expanded #sidebar-collapse-btn svg { transform: rotate(180deg); }

#sidebar-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 16px;
}
#sidebar-inner::-webkit-scrollbar { width:3px; }
#sidebar-inner::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius:2px; }

/* section header — hidden in collapsed strip */
.sidebar-section-header {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 14px 4px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  transition: opacity 0.15s, height 0.22s;
  pointer-events: none;
}
#sidebar.expanded .sidebar-section-header {
  opacity: 1;
  height: auto;
  padding: 12px 14px 4px;
  pointer-events: auto;
}

/* sidebar items — icon-centered by default */
.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 11px 0;
  cursor: pointer;
  color: var(--text-mid);
  font-size: 12px;
  transition: background var(--trans), color var(--trans), padding 0.22s, gap 0.22s;
  position: relative;
  user-select: none;
  white-space: nowrap;
}
/* expanded: left-align with label */
#sidebar.expanded .sidebar-item {
  justify-content: flex-start;
  gap: 10px;
  padding: 9px 14px;
}
.sidebar-item:hover { background: var(--tile-hover); color: var(--text); }
.sidebar-item.active {
  color: var(--accent);
  background: var(--accent-glow);
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.sidebar-item svg { width:16px; height:16px; flex-shrink:0; opacity:.7; }
.sidebar-item.active svg { opacity:1; }

/* count badge */
.sidebar-item .item-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-dim);
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
  /* hidden in collapsed strip */
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  padding-left: 0;
  padding-right: 0;
  border-width: 0;
  transition: opacity 0.15s, max-width 0.22s, padding 0.22s, border-width 0.15s;
}
#sidebar.expanded .sidebar-item .item-count {
  opacity: 1;
  max-width: 50px;
  padding: 1px 6px;
  border-width: 1px;
}

/* label */
.sidebar-item .item-label {
  flex: 1;
  overflow: hidden;
  opacity: 0;
  max-width: 0;
  transition: opacity 0.15s, max-width 0.22s;
  pointer-events: none;
}
#sidebar.expanded .sidebar-item .item-label {
  opacity: 1;
  max-width: 140px;
  pointer-events: auto;
}

/* rename inline */
.sidebar-item .item-label input.rename-input {
  background: var(--input-bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 2px 6px;
  width: 100%;
  outline: none;
}

/* tooltip on collapsed hover */
.sidebar-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-w) + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
/* only show tooltip when NOT expanded */
#sidebar:not(.expanded) .sidebar-item:hover::after { opacity: 1; }

/* add section button */
#add-section-btn {
  margin: 6px 10px;
  background: none;
  border: 1px dashed var(--border-med);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
  width: calc(100% - 20px);
  transition: border-color var(--trans), color var(--trans), opacity 0.15s;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  height: 0;
  padding-top: 0; padding-bottom: 0;
  border-width: 0;
}
#sidebar.expanded #add-section-btn {
  opacity: 1;
  pointer-events: auto;
  height: auto;
  padding: 6px 10px;
  border-width: 1px;
}
#add-section-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Main stage ────────────────────────────────────── */
#stage {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  /* Fixed launcher-column width — pane sits to its right */
  width: var(--stage-w, 380px);
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(.34,1.1,.64,1);
}
/* When pane is open, JS sets margin-right on stage.
   Stage width itself stays fixed so the list never reflows. */

/* grid bg */
#grid-bg {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, black 20%, transparent 100%);
}

/* section header inside stage */
#section-title {
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
  padding: 14px 14px 0;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
#section-title span { color: var(--text-dim); font-size:12px; font-family: var(--font-ui); font-weight:400; }

#app-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 40px;
  position: relative;
  z-index: 1;
}
#app-grid-wrap::-webkit-scrollbar { width:4px; }
#app-grid-wrap::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius:3px; }

#app-grid {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  align-items: stretch;
  position: relative;
}

/* ── App tile — horizontal row ─────────────────────── */
.app-tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-tile);
  padding: 10px 14px 10px 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--trans), border-color var(--trans), transform 0.15s, box-shadow 0.18s;
  animation: tile-in 0.35s cubic-bezier(.34,1.56,.64,1) both;
}
.app-tile:nth-child(1)  { animation-delay:0ms }
.app-tile:nth-child(2)  { animation-delay:35ms }
.app-tile:nth-child(3)  { animation-delay:70ms }
.app-tile:nth-child(4)  { animation-delay:105ms }
.app-tile:nth-child(5)  { animation-delay:140ms }
.app-tile:nth-child(6)  { animation-delay:175ms }
.app-tile:nth-child(7)  { animation-delay:210ms }
.app-tile:nth-child(8)  { animation-delay:245ms }
.app-tile:nth-child(9)  { animation-delay:280ms }
.app-tile:nth-child(n+10) { animation-delay:315ms }

@keyframes tile-in {
  from { opacity:0; transform:scale(0.86) translateY(10px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}
.app-tile::before {
  content:'';
  position:absolute; inset:0;
  background: radial-gradient(circle at 50% 0%, var(--accent-glow), transparent 62%);
  opacity:0; transition:opacity 0.2s; pointer-events:none;
}
.app-tile:hover {
  background: var(--tile-hover);
  border-color: var(--border-med);
  transform: scale(1.045) translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
}
.app-tile:hover::before { opacity:1; }
.app-tile:active { transform: scale(0.97); }

/* dragging state */
.app-tile.dragging {
  opacity: 0.25;
  transform: scale(0.94);
  pointer-events: none;
}
/* drop-before: line above the target row */
.app-tile.drop-before::before {
  content: '';
  position: absolute;
  top: -6px; left: 10%; right: 10%;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 1 !important;
  background-image: none !important;
}
.app-tile.drop-after::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 10%; right: 10%;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.tile-icon-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--icon-size, 40px);
  height: var(--icon-size, 40px);
}
.tile-icon-wrap svg {
  width: var(--icon-size, 40px);
  height: var(--icon-size, 40px);
  transition: filter 0.18s;
}
.app-tile:hover .tile-icon-wrap svg {
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.tile-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0;
  line-height: 1.3;
  transition: color var(--trans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.tile-url-hint {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  flex-shrink: 1;
  min-width: 0;
}
.app-tile:hover .tile-label { color: var(--text); }

/* tile action buttons (shown on hover) */
.tile-actions {
  position: absolute;
  top: 6px; right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 5;
}
.app-tile:hover .tile-actions { opacity:1; }
.tile-btn {
  width: 22px; height: 22px;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: 5px;
  cursor: pointer;
  display: flex; align-items:center; justify-content:center;
  color: var(--text-dim);
  transition: background var(--trans), color var(--trans);
}
.tile-btn:hover { background: var(--accent-glow); color: var(--accent); border-color: var(--accent); }
.tile-btn svg { width:11px; height:11px; }

/* drag handle — always visible on hover, high contrast */
.tile-drag-handle {
  position: absolute;
  top: 7px; left: 7px;
  opacity: 0;
  cursor: grab;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: 5px;
  padding: 3px;
  transition: opacity 0.15s, background var(--trans);
  z-index: 5;
  line-height: 0;
}
.app-tile:hover .tile-drag-handle { opacity: 1; }
.tile-drag-handle:hover { background: var(--accent-glow); }
.tile-drag-handle svg { width: 12px; height: 12px; display: block; }
.tile-drag-handle:active { cursor: grabbing; }

/* hidden tile (search) */
.app-tile.hidden { display:none; }

/* ── Settings panel ────────────────────────────────── */
#settings-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: var(--settings-w);
  background: var(--settings-bg);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(.34,1.2,.64,1);
  overflow: hidden;
}
#settings-panel.open { transform: translateX(0); }

#settings-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#settings-header h3 {
  font-family: var(--font-disp);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
#settings-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); transition: color var(--trans);
}
#settings-close:hover { color: var(--text); }
#settings-close svg { width:16px; height:16px; display:block; }

#settings-body {
  flex:1;
  overflow-y:auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
#settings-body::-webkit-scrollbar { width:4px; }
#settings-body::-webkit-scrollbar-thumb { background:var(--scrollbar); border-radius:2px; }

.setting-group { display:flex; flex-direction:column; gap:10px; }
.setting-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.setting-row {
  display:flex;
  align-items:center;
  gap:12px;
}
.setting-row input[type="range"] {
  flex:1;
  -webkit-appearance: none;
  height: 3px;
  background: var(--border-med);
  border-radius: 2px;
  outline: none;
  accent-color: var(--accent);
}
.setting-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance:none;
  width:14px; height:14px;
  border-radius:50%;
  background: var(--accent);
  cursor:pointer;
}
.setting-val {
  font-size:11px;
  color:var(--text-mid);
  min-width:36px;
  text-align:right;
}

/* ── Add App modal ─────────────────────────────────── */
#modal-overlay {
  position: fixed; inset:0; z-index:300;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none;
  transition: opacity 0.2s;
}
#modal-overlay.open { opacity:1; pointer-events:all; }
#modal {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: 16px;
  padding: 28px;
  width: 460px;
  max-width: 95vw;
  display:flex;
  flex-direction:column;
  gap:18px;
  transform: scale(0.94);
  transition: transform 0.22s cubic-bezier(.34,1.2,.64,1);
}
#modal-overlay.open #modal { transform: scale(1); }
#modal h3 {
  font-family: var(--font-disp);
  font-weight:800;
  font-size:17px;
  letter-spacing:-0.02em;
}
.modal-field { display:flex; flex-direction:column; gap:6px; }
.modal-field label { font-size:10px; letter-spacing:0.14em; text-transform:uppercase; color:var(--text-dim); }
.modal-field input, .modal-field select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 9px 12px;
  outline:none;
  transition: border-color var(--trans);
}
.modal-field input:focus, .modal-field select:focus { border-color: var(--accent); }

/* icon picker grid */
#icon-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.icon-opt {
  aspect-ratio:1;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  transition: border-color var(--trans), background var(--trans);
}
.icon-opt svg { width:22px; height:22px; }
.icon-opt:hover { border-color: var(--border-med); background: var(--tile-hover); }
.icon-opt.selected { border-color: var(--accent); background: var(--accent-glow); }

/* color swatch row */
#color-swatches {
  display:flex; flex-wrap:wrap; gap:8px;
}
.color-swatch {
  width:26px; height:26px;
  border-radius:50%;
  cursor:pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text); }

.modal-actions {
  display:flex; justify-content:flex-end; gap:10px;
}
.btn-ghost {
  background:none;
  border:1px solid var(--border-med);
  border-radius:var(--radius-sm);
  color:var(--text-mid);
  font-family:var(--font-ui);
  font-size:12px;
  padding:8px 16px;
  cursor:pointer;
  transition: background var(--trans), color var(--trans);
}
.btn-ghost:hover { background:var(--tile-hover); color:var(--text); }
.btn-primary {
  background: var(--accent);
  border:none;
  border-radius:var(--radius-sm);
  color:#080a0f;
  font-family:var(--font-ui);
  font-size:12px;
  font-weight:500;
  padding:8px 18px;
  cursor:pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.btn-primary:hover { opacity:0.88; }
.btn-primary:active { transform:scale(0.97); }

/* ── FAB add button ────────────────────────────────── */
#fab-add {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 46px; height: 46px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items:center; justify-content:center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 500;
  transition: transform 0.15s, box-shadow 0.15s;
  color: #080a0f;
}
#fab-add:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(0,0,0,0.35); }
#fab-add svg { width:20px; height:20px; }
/* JS sets --fab-right dynamically so FAB stays left of pane */

/* ── Split pane (iframe viewer) ───────────────────── */
/* --pane-w is set dynamically by JS; default 60vw    */
:root { --pane-w: 60vw; }

/* Drag divider — sits on left edge of pane */
#pane-divider {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  /* left is set by JS to match pane left edge */
  width: 8px;
  z-index: 160;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#pane-divider.visible {
  opacity: 1;
  pointer-events: all;
}
#pane-divider::before {
  content: '';
  width: 2px;
  height: 100%;
  background: var(--border-med);
  border-radius: 1px;
  transition: background 0.15s, width 0.15s;
}
#pane-divider:hover::before,
#pane-divider.dragging::before {
  width: 3px;
  background: var(--accent);
}
/* grip dots */
#pane-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 32px;
  background: radial-gradient(circle, var(--accent) 1.5px, transparent 1.5px);
  background-size: 4px 8px;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
#pane-divider:hover::after,
#pane-divider.dragging::after { opacity: 1; }

#split-pane {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: var(--pane-w);
  background: var(--surface);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(.34,1.1,.64,1);
}
#split-pane.open { transform: translateX(0); }
/* suppress transition during live drag */
#split-pane.resizing { transition: none; }

#split-pane-header {
  height: 46px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 14px;
  flex-shrink: 0;
}
#pane-url-bar {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-mid);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}
#pane-app-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.pane-btn {
  width: 30px; height: 30px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-mid);
  flex-shrink: 0;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.pane-btn:hover { background: var(--tile-hover); color: var(--text); border-color: var(--border-med); }
.pane-btn svg { width: 14px; height: 14px; }
#pane-close:hover { color: var(--text); }

#split-pane iframe {
  flex: 1;
  width: 100%;
  border: none;
  border-left: 1px solid var(--border);
  display: block;
}
#pane-blocked {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  text-align: center;
  color: var(--text-mid);
  border-left: 1px solid var(--border);
}
#pane-blocked svg { width: 48px; height: 48px; opacity: 0.3; }
#pane-blocked p { font-size: 13px; line-height: 1.7; }
#pane-blocked p strong { display: block; font-size: 14px; color: var(--text); margin-bottom: 6px; }
#pane-blocked a {
  display: inline-block;
  background: var(--accent);
  color: #080a0f;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: opacity 0.15s;
}
#pane-blocked a:hover { opacity: 0.85; }

/* stage shrinks to leave room for pane — driven by JS setting margin-right */
#stage { transition: margin-right 0.3s cubic-bezier(.34,1.1,.64,1); }
#stage.resizing { transition: none; }

/* launch choice bar */
#launch-choice {
  position: fixed;
  z-index: 400;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  gap: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92) translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
}
#launch-choice.open {
  opacity: 1;
  pointer-events: all;
  transform: scale(1) translateY(0);
}
.launch-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--trans);
  border: none;
  background: none;
  color: var(--text);
  font-family: var(--font-ui);
}
.launch-opt:hover { background: var(--tile-hover); }
.launch-opt svg { width: 20px; height: 20px; color: var(--accent); }
.launch-opt span { font-size: 10px; color: var(--text-mid); white-space: nowrap; }

/* ── Proxy toggle in modal ────────────────────────── */
.proxy-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.proxy-toggle-wrap input[type="checkbox"] { display: none; }
.proxy-toggle-track {
  width: 36px; height: 20px;
  background: var(--border-med);
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.proxy-toggle-wrap input:checked + .proxy-toggle-track { background: var(--accent); }
.proxy-toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.proxy-toggle-wrap input:checked + .proxy-toggle-track .proxy-toggle-thumb {
  transform: translateX(16px);
}
.proxy-toggle-label {
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.4;
}
.proxy-hint {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 6px;
}
.proxy-hint a { color: var(--accent); text-decoration: none; }

/* proxy badge on tile */
.tile-proxy-badge {
  position: absolute;
  bottom: 6px; right: 6px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

/* ── Scrollbar global ─────────────────────────────── */
::-webkit-scrollbar { width:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--scrollbar); border-radius:3px; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width:700px) {
  #sidebar { display:none; }
  #shell { grid-template-columns: 1fr; }
  #topbar-logo { width:auto; }
  :root { --pane-w: 100vw; }
}
