* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --app-height: 100vh;
}

html {
  height: var(--app-height);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: var(--app-height);
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* --- Auth screen --- */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--app-height);
}

.auth-container {
  text-align: center;
}

.auth-container h1 {
  font-size: 28px;
  color: #e94560;
  margin-bottom: 16px;
}

.auth-container p {
  font-size: 16px;
  color: #888;
}

/* --- Folder list screen --- */
#folder-screen {
  display: flex;
  flex-direction: column;
  height: var(--app-height);
}

.header {
  padding: 16px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-shrink: 0;
}

.header h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #e94560;
}

#search {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid #0f3460;
  border-radius: 8px;
  background: #1a1a2e;
  color: #e0e0e0;
  outline: none;
}

#search:focus {
  border-color: #e94560;
}

#search::placeholder {
  color: #666;
}

.active-sessions {
  padding: 8px 16px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-shrink: 0;
}

.active-sessions h3 {
  font-size: 13px;
  color: #888;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: #0f3460;
  border-radius: 6px;
  cursor: pointer;
}

.session-item:active {
  background: #1a4a8a;
}

.session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ecca3;
  margin-right: 10px;
  flex-shrink: 0;
}

.session-dot.disconnected {
  background: #f0a500;
}

.session-name {
  flex: 1;
  font-size: 15px;
}

.folder-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  margin-bottom: 4px;
  background: #16213e;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.folder-item:active {
  background: #0f3460;
}

.folder-name {
  font-size: 16px;
  flex: 1;
}

.folder-arrow {
  color: #555;
  font-size: 18px;
}

.folder-count {
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  color: #666;
  flex-shrink: 0;
}

/* --- Terminal screen --- */
#terminal-screen {
  display: none;
  flex-direction: column;
  height: var(--app-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.terminal-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  min-height: 48px;
  flex-shrink: 0;
}

#back-btn {
  background: none;
  border: 1px solid #0f3460;
  color: #e0e0e0;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  margin-right: 12px;
  white-space: nowrap;
}

#back-btn:active {
  background: #0f3460;
}

#terminal-title {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

#kill-btn {
  background: #e94560;
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  margin-left: 8px;
  white-space: nowrap;
}

#kill-btn:active {
  background: #c0392b;
}

.session-kill {
  background: none;
  border: none;
  color: #e94560;
  font-size: 22px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.session-kill:active {
  color: #c0392b;
}

#terminal-container {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.term-wrapper {
  width: 100%;
  height: 100%;
}

/* --- Toolbar --- */
#toolbar {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: #16213e;
  border-top: 1px solid #0f3460;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.tool-btn {
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 15px;
  font-family: 'Menlo', monospace;
  background: #0f3460;
  color: #e0e0e0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  text-align: center;
}

.tool-btn:active {
  background: #e94560;
}

/* xterm overrides */
.xterm {
  padding: 4px;
  height: 100% !important;
}

.xterm-viewport::-webkit-scrollbar {
  width: 6px;
}

.xterm-viewport::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

/* Loading spinner */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 16px;
  color: #888;
}

.hidden {
  display: none !important;
}
