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

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: #0d1117;
  color: #e6edf3;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  letter-spacing: -0.01em;
}
.hidden { display: none !important; }

/* ---------- Auth screen ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 320px;
  background: #161b22;
  border: 1px solid rgba(99,179,237,0.15);
  border-radius: 8px;
  padding: 24px;
}
.auth-logo {
  font-size: 18px;
  font-weight: 700;
  color: #63b3ed;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  text-align: center;
}
.auth-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.auth-tab {
  flex: 1; padding: 8px; font-family: inherit; font-size: 12px;
  background: transparent; border: 1px solid rgba(99,179,237,0.15);
  color: #8b949e; border-radius: 4px; cursor: pointer;
}
.auth-tab.active { border-color: #63b3ed; color: #63b3ed; }
.auth-form label { font-size: 11px; color: #5c7080; display: block; margin: 10px 0 4px; }
.auth-form input {
  width: 100%; padding: 8px 10px; background: #0d1117;
  border: 1px solid rgba(99,179,237,0.15); border-radius: 4px;
  color: #e6edf3; font-family: inherit; font-size: 12px;
}
.auth-form input:focus { outline: none; border-color: #63b3ed; }
.auth-submit {
  width: 100%; margin-top: 16px; padding: 9px; font-family: inherit; font-size: 12px;
  background: rgba(99,179,237,0.15); border: 1px solid #63b3ed; color: #63b3ed;
  border-radius: 4px; cursor: pointer;
}
.auth-submit:hover { background: rgba(99,179,237,0.25); }
.auth-error { color: #f85149; font-size: 11px; margin-top: 8px; min-height: 14px; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #161b22; border-bottom: 1px solid rgba(99,179,237,0.15); }
.topbar-logo { font-size: 14px; font-weight: 700; color: #63b3ed; letter-spacing: -0.02em; }
.topbar-project, select.topbar-project { font-size: 12px; color: #8b949e; padding: 3px 8px; border: 1px solid rgba(99,179,237,0.15); border-radius: 4px; background: #0d1117; }
.live-badge { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #56d364; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #56d364; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.topbar-btn { padding: 4px 10px; font-size: 11px; font-family: inherit; background: transparent; border: 1px solid rgba(99,179,237,0.15); color: #8b949e; border-radius: 4px; cursor: pointer; }
.topbar-btn:hover { border-color: #63b3ed; color: #63b3ed; }
.topbar-user { margin-left: auto; font-size: 11px; color: #5c7080; }

/* ---------- Main grid ---------- */
.main { display: grid; grid-template-columns: 44px 1fr 240px; min-height: 480px; }
.sidebar { background: #161b22; border-right: 1px solid rgba(99,179,237,0.15); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; }
.tool-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 4px; color: #5c7080; cursor: pointer; border: none; background: transparent; font-size: 13px; }
.tool-btn:hover, .tool-btn.active { background: #222c3c; color: #63b3ed; }
.tool-sep { width: 24px; height: 1px; background: rgba(99,179,237,0.15); margin: 4px 0; }

.viewer-wrap { position: relative; background: #060c14; overflow: hidden; }
.viewer-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(99,179,237,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(99,179,237,0.06) 1px, transparent 1px); background-size: 32px 32px; }
.viewer-placeholder { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.placeholder-icon { font-size: 32px; color: #5c7080; opacity: 0.4; }
.speckle-logo { font-size: 11px; color: #63b3ed; letter-spacing: 0.15em; text-transform: uppercase; opacity: 0.6; }
.placeholder-text { font-size: 11px; color: #5c7080; }
.connect-btn { padding: 8px 20px; font-size: 12px; font-family: inherit; background: rgba(99,179,237,0.12); border: 1px solid #63b3ed; color: #63b3ed; border-radius: 4px; cursor: pointer; }
.connect-btn:hover { background: rgba(99,179,237,0.22); }
.speckle-embed { width: 100%; height: 100%; border: none; display: block; position: relative; z-index: 2; min-height: 480px; }
.model-label { position: absolute; top: 10px; left: 10px; z-index: 4; display: flex; align-items: center; gap: 6px; font-size: 11px; color: #8b949e; background: rgba(13,17,23,0.8); padding: 4px 8px; border-radius: 4px; border: 1px solid rgba(99,179,237,0.15); }
.model-label-dot { width: 6px; height: 6px; border-radius: 50%; background: #4fd1c5; }

.right-panel { background: #161b22; border-left: 1px solid rgba(99,179,237,0.15); display: flex; flex-direction: column; overflow: hidden; }
.rp-section { border-bottom: 1px solid rgba(99,179,237,0.15); padding: 10px 12px; }
.rp-label { font-size: 10px; color: #5c7080; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.stream-list { display: flex; flex-direction: column; gap: 6px; }
.stream-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; background: #1c2230; border-radius: 4px; cursor: pointer; font-size: 11px; color: #e6edf3; }
.stream-row:hover { border: 1px solid #63b3ed; }
.stream-row .del { color: #f85149; cursor: pointer; padding: 0 4px; }
.activity-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(99,179,237,0.1); font-size: 11px; color: #8b949e; }
.activity-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.bottom-strip { border-top: 1px solid rgba(99,179,237,0.15); background: #161b22; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.bs-label { font-size: 10px; color: #5c7080; text-transform: uppercase; letter-spacing: 0.1em; flex-shrink: 0; }
.saved-views { display: flex; gap: 8px; flex: 1; overflow-x: auto; }
.sv-card { flex-shrink: 0; width: 110px; padding: 8px; background: #1c2230; border: 1px solid rgba(99,179,237,0.15); border-radius: 4px; font-size: 11px; color: #8b949e; cursor: pointer; }
.sv-card:hover { border-color: #63b3ed; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #161b22; border: 1px solid rgba(99,179,237,0.15); border-radius: 8px; padding: 20px; width: 340px; }
.modal h3 { font-size: 13px; color: #63b3ed; margin-bottom: 14px; }
.modal label { font-size: 11px; color: #5c7080; display: block; margin-bottom: 4px; }
.modal input { width: 100%; padding: 7px 10px; background: #0d1117; border: 1px solid rgba(99,179,237,0.15); border-radius: 4px; color: #e6edf3; font-family: inherit; font-size: 12px; margin-bottom: 10px; }
.modal input:focus { outline: none; border-color: #63b3ed; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.btn-cancel { padding: 6px 14px; font-family: inherit; font-size: 12px; background: transparent; border: 1px solid rgba(99,179,237,0.15); color: #8b949e; border-radius: 4px; cursor: pointer; }
.btn-load { padding: 6px 14px; font-family: inherit; font-size: 12px; background: rgba(99,179,237,0.15); border: 1px solid #63b3ed; color: #63b3ed; border-radius: 4px; cursor: pointer; }
.btn-load:hover { background: rgba(99,179,237,0.25); }
