:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080b12;
  color: #e8edf5;
  --panel: #101621;
  --panel-2: #151d2b;
  --line: #263247;
  --muted: #8e9bb0;
  --accent: #56d5ad;
  --accent-strong: #2cb98d;
  --danger: #ff7b86;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }

.login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(86, 213, 173, .14), transparent 36%),
    #080b12;
}

.login-card, .dialog-card {
  width: min(100%, 390px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 22, 33, .96);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .4);
}

.login-card img { display: block; margin: 0 auto 18px; }
.login-card h1 { margin: 4px 0 8px; text-align: center; font-size: 28px; }
.eyebrow { color: var(--accent); text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.muted { color: var(--muted); text-align: center; margin: 0 0 28px; }
label { display: block; margin: 14px 0 7px; color: #bdc8d9; font-size: 13px; font-weight: 650; }
input, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: #090e16;
  color: #f4f7fb;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(86, 213, 173, .12); }
button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
}
button:hover { border-color: #40506b; background: #1a2535; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { border-color: transparent; background: var(--accent-strong); color: #04100c; font-weight: 800; }
.primary:hover { border-color: transparent; background: var(--accent); }
.login-card .primary { width: 100%; margin-top: 20px; min-height: 46px; }
.error { min-height: 18px; color: var(--danger); font-size: 13px; }

.app-view { height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.topbar { min-height: 50px; display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 800; font-size: 13px; }
.tabs { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.tab { display: flex; align-items: center; gap: 8px; max-width: 210px; white-space: nowrap; background: transparent; color: var(--muted); }
.tab.active { color: #f4f7fb; background: #090e16; border-color: #3c4b64; }
.tab-name { overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #5f6b7a; }
.status-dot.online { background: var(--accent); box-shadow: 0 0 8px rgba(86, 213, 173, .5); }
.tab-close { padding: 0 2px; color: #7d899c; font-size: 16px; }
.tab-close:hover { color: var(--danger); }
.actions { display: flex; gap: 5px; }
.upload-progress { padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.upload-progress-info { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: #bdc8d9; font-size: 12px; }
.upload-progress-info span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress progress { display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; accent-color: var(--accent-strong); }
.upload-progress progress::-webkit-progress-bar { background: #090e16; }
.upload-progress progress::-webkit-progress-value { background: var(--accent-strong); }
.upload-progress progress::-moz-progress-bar { background: var(--accent-strong); }
.terminals { position: relative; flex: 1; min-height: 0; background: #080b12; }
.terminal-pane { display: none; position: absolute; inset: 0; padding: 5px; }
.terminal-pane.active { display: block; }
.terminal-pane .xterm { height: 100%; }
.empty-state { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.empty-state h2 { color: #e8edf5; margin: 16px 0 4px; }
.empty-state p { margin: 0 0 18px; }
.keybar { display: none; gap: 5px; overflow-x: auto; padding: 6px; background: var(--panel); border-top: 1px solid var(--line); }
.keybar button { flex: 0 0 auto; min-width: 48px; }

dialog { width: min(92vw, 440px); padding: 0; border: 0; border-radius: 18px; color: inherit; background: transparent; }
dialog::backdrop { background: rgba(2, 5, 10, .74); backdrop-filter: blur(5px); }
.dialog-card { width: 100%; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h2 { margin: 0; }
.dialog-head button { border: 0; background: transparent; font-size: 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.link-button { width: 100%; margin-top: 10px; border: 0; background: transparent; color: var(--accent); }
#create-project-fields { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
#create-project { width: 100%; margin-top: 12px; }

@media (max-width: 760px) {
  .brand span { display: none; }
  .topbar { min-height: 46px; gap: 5px; padding: 4px 6px; }
  .actions button:not(#new-session):not(#browser) { display: none; }
  .tab { max-width: 150px; padding: 6px 8px; }
  .terminal-pane { padding: 2px; }
  .keybar { display: flex; }
  .login-card { padding: 26px 22px; }
}
