* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
}

/* --- Picker View --- */

#picker-view {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  user-select: none;
  -webkit-user-select: none;
}

/* --- Header --- */

header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #21262d;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e6edf3;
  letter-spacing: -0.03em;
  margin-bottom: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

h1 .h1-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #58a6ff 0%, #3b82f6 100%);
  color: #fff;
  border-radius: 7px;
  font-size: 0.7rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  letter-spacing: 0;
  flex-shrink: 0;
  animation: icon-glow 3s ease-in-out infinite;
}

@keyframes icon-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 166, 255, 0); }
  50% { box-shadow: 0 0 12px 2px rgba(88, 166, 255, 0.35); }
}

h1 .h1-accent {
  color: #58a6ff;
  font-weight: 300;
}

h1 .h1-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: #58a6ff;
  margin-left: 0.1rem;
  animation: cursor-blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.subtitle {
  color: #6e7681;
  font-size: 0.8rem;
}

/* --- Header Row --- */

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* --- Notification Button --- */

.btn-notify {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #484f58;
  cursor: pointer;
  -webkit-appearance: none;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn-notify:active {
  transform: scale(0.92);
  background: #21262d;
}

.notify-icon {
  width: 16px;
  height: 16px;
}

.notify-slash {
  opacity: 1;
  transition: opacity 0.15s;
}

.btn-notify.notify-on {
  background: #0d1929;
  border-color: #1a3050;
  color: #58a6ff;
}

.btn-notify.notify-on .notify-slash {
  opacity: 0;
}

.btn-notify.notify-on:active {
  background: #1a3050;
}

.btn-notify.notify-denied {
  background: #161b22;
  border-color: #21262d;
  color: #30363d;
  cursor: default;
}

/* --- Create Session --- */

.create-session {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.create-session input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.create-session input:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px #58a6ff18;
}

.create-session input::placeholder {
  color: #484f58;
}

.create-session button {
  padding: 0.6rem 1rem;
  background: #238636;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  -webkit-appearance: none;
  transition: background 0.15s;
}

.create-session button:active {
  background: #2ea043;
}

/* --- Buttons --- */

.btn-secondary {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  -webkit-appearance: none;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:active {
  background: #21262d;
  border-color: #484f58;
}

/* --- Error --- */

.error {
  background: #1a0d0d;
  border: 1px solid #f8514933;
  color: #f85149;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.8rem;
}

/* --- Section Label --- */

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #484f58;
  margin-bottom: 0.5rem;
}

/* --- Session Search --- */

.session-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.session-search:focus {
  border-color: #58a6ff;
}

.session-search::placeholder {
  color: #484f58;
}

/* --- Sessions List --- */

.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.loading {
  color: #6e7681;
  text-align: center;
  padding: 2rem;
  font-size: 0.85rem;
}

/* --- Session Card --- */

.session-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem;
  background: #161b22;
  border: 1px solid #21262d;
  border-left: 3px solid #21262d;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.1s;
  min-height: 3rem;
  touch-action: manipulation;
}

.session-card:active {
  background: #1c2333;
  border-color: #58a6ff;
  border-left-color: #58a6ff;
  transform: scale(0.985);
}

/* Left accent bar colors based on Claude status */
.session-card.claude-running-border {
  border-left-color: #3fb950;
}

.session-card.claude-standby-border {
  border-left-color: #58a6ff;
  background: #0c1520;
}

/* --- Swipe Actions --- */

.swipe-container {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}

.swipe-action {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.swipe-left-action {
  justify-content: flex-end;
  padding-right: 1.2rem;
  background: #f85149;
  color: #fff;
}

.swipe-right-action {
  justify-content: flex-start;
  padding-left: 1.2rem;
  background: #58a6ff;
  color: #fff;
}

.swipe-container.show-left-action .swipe-left-action {
  opacity: 1;
}

.swipe-container.show-right-action .swipe-right-action {
  opacity: 1;
}

.swipe-container .session-card {
  position: relative;
  z-index: 1;
}

/* --- Drag Handle --- */

.drag-handle {
  color: #30363d;
  font-size: 1rem;
  cursor: grab;
  padding: 0 0.15rem;
  line-height: 1;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
  color: #58a6ff;
}

.session-group.dragging {
  opacity: 0.15;
  transform: scale(0.97);
  transition: opacity 0.2s, transform 0.2s;
}

/* Floating ghost while dragging */
.drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.9;
  transform: scale(1.03);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px #58a6ff40;
  border-radius: 10px;
  transition: transform 0.1s;
}

/* Placeholder gap */
.drag-placeholder {
  border: 2px dashed #30363d;
  border-radius: 10px;
  background: #58a6ff08;
  transition: height 0.2s;
}

/* Drop indicators */
.session-group.drag-over-above {
  position: relative;
}
.session-group.drag-over-above::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: #58a6ff;
  border-radius: 2px;
  z-index: 10;
}

.session-group.drag-over-below {
  position: relative;
}
.session-group.drag-over-below::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: #58a6ff;
  border-radius: 2px;
  z-index: 10;
}

/* --- Session Icon --- */

.session-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  flex-shrink: 0;
  line-height: 1;
}

.session-icon.default {
  background: #21262d;
  color: #6e7681;
}

.session-icon.running {
  background: #0d2818;
  color: #3fb950;
  font-size: 0.6rem;
  overflow: hidden;
}

.icon-gear {
  display: inline-block;
  font-size: 1.4rem;
  animation: gear-spin 4s linear infinite;
}

@keyframes gear-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.icon-zzz {
  display: inline-flex;
  align-items: baseline;
  gap: 0.05em;
  font-weight: 700;
  font-size: 0.95rem;
  color: #58a6ff;
  animation: zzz-float 2.5s ease-in-out infinite;
}
.icon-zzz small {
  font-size: 0.55rem;
  opacity: 0.6;
}
.icon-zzz small:last-child {
  font-size: 0.4rem;
  opacity: 0.35;
}

@keyframes zzz-float {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(-3px); opacity: 1; }
}

.session-icon.waiting {
  background: #2d1f04;
  color: #d29922;
  font-size: 0.95rem;
  font-weight: 800;
}

.session-icon.standby {
  background: #0c1929;
  color: #58a6ff;
}

/* --- Session Info --- */

.session-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.session-name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.session-name {
  font-weight: 600;
  color: #e6edf3;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta {
  font-size: 0.7rem;
  color: #484f58;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-sessions {
  text-align: center;
  color: #6e7681;
  padding: 2rem;
  font-size: 0.85rem;
}

/* --- Claude Status Badges --- */

.session-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.badge-claude {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

.badge-claude .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-claude.running {
  background: #0d2818;
  color: #3fb950;
}
.badge-claude.running .status-dot {
  background: #3fb950;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.badge-claude.waiting {
  background: #d29922;
  color: #1c1200;
}
.badge-claude.waiting .status-dot {
  background: #1c1200;
  animation: pulse-dot 1s ease-in-out infinite;
}

.badge-claude.standby {
  background: #0c1929;
  color: #58a6ff;
}
.badge-claude.standby .status-dot {
  background: #58a6ff;
}

/* --- Session Card: Claude Waiting State --- */

.session-card.claude-waiting {
  border-color: #3d2a06;
  border-left-color: #d29922;
  background: #13100a;
  animation: pulse-border 2.5s ease-in-out infinite;
}

.session-card.claude-waiting:active {
  background: #2d1f04;
}

/* --- Flash Overlay --- */

.flash-overlay {
  position: fixed;
  inset: 0;
  background: #58a6ff;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.15s ease-out;
}

.flash-overlay.flash-active {
  opacity: 0.15;
}

.session-question {
  font-size: 0.75rem;
  color: #d29922;
  margin-top: 0.3rem;
  line-height: 1.35;
  opacity: 0.85;
}
.sq-header {
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.sq-details {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.7rem;
  color: #c9d1d9;
  padding: 0.2rem 0 0.2rem 0.5rem;
  margin: 0.1rem 0;
  border-left: 2px solid #30363d;
  white-space: pre-wrap;
  word-break: break-all;
}
.sq-desc {
  font-size: 0.68rem;
  color: #8b949e;
  margin-top: 0.1rem;
}
.sq-context {
  font-size: 0.68rem;
  color: #8b949e;
  margin-top: 0.2rem;
  font-style: italic;
}
.sq-text {
  margin-top: 0.25rem;
}

/* --- Session Group (card + action bar) --- */

.session-group {
  display: flex;
  flex-direction: column;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  background: #13100a;
  border: 1px solid #3d2a06;
  border-top: none;
  border-radius: 0 0 10px 10px;
  margin-top: -4px;
  padding-top: calc(0.45rem + 4px);
}

.session-group.has-actions .session-card {
  border-radius: 10px 10px 0 0;
}

.session-option {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.45rem 0.8rem;
  background: #1c1600;
  color: #d29922;
  border: 1px solid #3d2a06;
  border-radius: 6px;
  cursor: pointer;
  -webkit-appearance: none;
  touch-action: manipulation;
  position: relative;
  z-index: 10;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.session-option:active {
  background: #d29922;
  color: #0d1117;
  transform: scale(0.95);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

@keyframes pulse-border {
  0%, 100% { border-color: #3d2a06; }
  50% { border-color: #6b4d0e; }
}

/* --- Picker Actions --- */

.picker-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 1rem;
}

.picker-actions .btn-secondary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.8rem;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  color: #8b949e;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.picker-actions .btn-secondary:active {
  background: #21262d;
  border-color: #484f58;
  color: #e6edf3;
  transform: scale(0.97);
}

.picker-actions .btn-secondary .btn-icon {
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.6;
}
.btn-spinner {
  display: inline-block;
  animation: gear-spin 0.8s linear infinite;
}
.btn-spinning {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

.btn-dual.active-mode {
  background: #0d1929 !important;
  color: #58a6ff !important;
  border-color: #58a6ff !important;
  font-weight: 600;
}

.btn-dual.active-mode .btn-icon {
  opacity: 1;
}

/* --- Dual Select Mode --- */

.session-card .dual-check {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid #30363d;
  border-radius: 6px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.dual-select-mode .session-card .dual-check {
  display: flex;
}

.session-card.dual-selected .dual-check {
  background: #58a6ff;
  border-color: #58a6ff;
  color: #fff;
}

.session-card.dual-selected {
  border-color: #58a6ff;
  border-left-color: #58a6ff;
  background: #0d1929;
}

/* --- Usage Bar --- */

.usage-bar {
  margin-top: 0.75rem;
  padding: 0.5rem 0.7rem;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 8px;
  font-size: 0.7rem;
  color: #6e7681;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.usage-bar:empty {
  display: none;
}

.usage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.8rem;
}

.usage-row-main {
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #21262d;
}

.usage-row-detail {
  opacity: 0.7;
}

.usage-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.usage-stat .usage-label {
  color: #484f58;
}

.usage-cost {
  color: #d29922 !important;
}

.usage-progress-bar {
  height: 4px;
  background: #21262d;
  border-radius: 2px;
  overflow: hidden;
}

.usage-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.usage-cost-green { color: #3fb950 !important; }
.usage-cost-green.usage-progress-fill { background: #3fb950; }
.usage-cost-yellow { color: #d29922 !important; }
.usage-cost-yellow.usage-progress-fill { background: #d29922; }
.usage-cost-red { color: #f85149 !important; }
.usage-cost-red.usage-progress-fill { background: #f85149; }

.usage-stat .usage-value {
  color: #8b949e;
  font-weight: 600;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.7rem;
}

/* --- Terminal View --- */

#terminal-view {
  display: flex;
  flex-direction: column;
  height: var(--vh, 100dvh);
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.65rem;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
  min-height: 2.6rem;
}

.terminal-header-left,
.terminal-header-right {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
  min-width: 2.5rem;
}

.terminal-header-right {
  justify-content: flex-end;
}

.terminal-header-left button,
.terminal-header-right button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 6px;
  color: #6e7681;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-appearance: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}

.terminal-header-left button:active,
.terminal-header-right button:active {
  background: #161b22;
  color: #e6edf3;
  border-color: #484f58;
  transform: scale(0.95);
}

.terminal-header-left .btn-icon,
.terminal-header-right .btn-icon {
  font-size: 0.85rem;
  line-height: 1;
}

#session-label {
  font-weight: 600;
  color: #58a6ff;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  flex: 1;
}

/* --- Panes Container --- */

#panes-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.pane.active {
  border-color: #58a6ff;
}

/* Pane tab — visible only when 2 panes open */
.pane-tab {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.5rem;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
  min-height: 1.6rem;
}

.pane-tab .pane-tab-name {
  font-size: 0.7rem;
  color: #6e7681;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pane.active .pane-tab .pane-tab-name {
  color: #58a6ff;
}

.pane-tab .btn-close-pane {
  background: none;
  border: none;
  color: #484f58;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  -webkit-appearance: none;
  transition: color 0.15s;
}

.pane-tab .btn-close-pane:active {
  color: #f85149;
}

#panes-container.dual .pane-tab {
  display: flex;
}

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

/* --- Quick Commands --- */

.quick-commands-wrapper {
  flex-shrink: 0;
  background: #0d1117;
  border-top: 1px solid #21262d;
  padding: 0.25rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  user-select: none;
  -webkit-user-select: none;
}

.quick-commands {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-commands::-webkit-scrollbar {
  display: none;
}

.quick-commands button {
  flex-shrink: 0;
  padding: 0.4rem 0.65rem;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 6px;
  color: #8b949e;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  cursor: pointer;
  -webkit-appearance: none;
  white-space: nowrap;
  min-width: 2.2rem;
  text-align: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.1s;
}

.quick-commands button:active {
  transform: scale(0.92);
}

/* Number keys — blue */
.quick-commands button.qc-num {
  background: #0d1929;
  border-color: #1a3050;
  color: #58a6ff;
  font-weight: 600;
  flex: 1;
}
.quick-commands button.qc-num:active {
  background: #58a6ff;
  color: #0d1117;
}

/* Enter — green */
.quick-commands button.qc-enter {
  background: #0d2818;
  border-color: #1a4028;
  color: #3fb950;
  font-weight: 600;
}
.quick-commands button.qc-enter:active {
  background: #3fb950;
  color: #0d1117;
}

/* C-c — red/danger */
.quick-commands button.qc-danger {
  background: #1a0d0d;
  border-color: #3d1515;
  color: #f85149;
  font-weight: 600;
}
.quick-commands button.qc-danger:active {
  background: #f85149;
  color: #0d1117;
}

/* Esc, Tab — neutral special */
.quick-commands button.qc-special {
  background: #161b22;
  border-color: #30363d;
  color: #c9d1d9;
  font-size: 0.7rem;
}
.quick-commands button.qc-special:active {
  background: #30363d;
  color: #e6edf3;
}

/* Mic — orange accent */
.quick-commands button.qc-mic {
  background: #291a0d;
  border-color: #50381a;
  color: #f0a040;
  font-size: 1rem;
}
.quick-commands button.qc-mic:active {
  background: #f0a040;
  color: #0d1117;
}

/* /usage command — purple */
.quick-commands button.qc-cmd {
  background: #1a0d29;
  border-color: #2d1a50;
  color: #bc8cff;
  font-weight: 600;
  font-size: 0.7rem;
}
.quick-commands button.qc-cmd:active {
  background: #bc8cff;
  color: #0d1117;
}

/* Arrow keys */
/* Arrow grid — inverted T layout */
.arrow-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  flex-shrink: 0;
}

.arrow-grid button.qc-arrow {
  background: #0d1929;
  border-color: #1a3050;
  color: #58a6ff;
  font-size: 0.85rem;
  padding: 0.2rem 0.45rem;
  min-width: 1.8rem;
  min-height: 1.5rem;
}
.arrow-grid button.qc-arrow:active {
  background: #58a6ff;
  color: #0d1117;
}

.quick-commands .qc-separator {
  width: 1px;
  background: #21262d;
  flex-shrink: 0;
  margin: 0.2rem 0.1rem;
}

/* --- Pull-to-refresh --- */

.ptr-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 3rem;
  transform: translateY(0);
  opacity: 0;
  z-index: 9000;
  pointer-events: none;
}

.ptr-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid #21262d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.ptr-indicator.ptr-ready .ptr-spinner {
  border-top-color: #3fb950;
  transform: rotate(180deg);
}

.ptr-indicator.ptr-refreshing .ptr-spinner {
  animation: spin 0.7s linear infinite;
}

/* --- Session Overlay --- */

#session-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#session-overlay[hidden] {
  display: none;
}

.overlay-content {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 14px;
  padding: 1rem;
  width: 100%;
  max-width: 400px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.overlay-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #e6edf3;
}

#btn-overlay-close {
  background: none;
  border: none;
  color: #484f58;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
  -webkit-appearance: none;
  transition: color 0.15s;
}

#btn-overlay-close:active {
  color: #f85149;
}

/* --- Connection Spinner --- */

#connect-spinner {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #0d1117;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: #6e7681;
  font-size: 0.85rem;
}

.spinner-ring {
  width: 32px;
  height: 32px;
  border: 2.5px solid #21262d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Command History Overlay --- */

.cmd-history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cmd-history-panel {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 14px;
  padding: 1rem;
  width: 100%;
  max-width: 400px;
  max-height: 60vh;
  overflow-y: auto;
}

.cmd-history-panel .overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.cmd-history-close {
  background: none;
  border: none;
  color: #484f58;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 0.3rem;
  -webkit-appearance: none;
}

.cmd-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cmd-history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 6px;
  color: #c9d1d9;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  cursor: pointer;
  -webkit-appearance: none;
  transition: background 0.15s, border-color 0.15s;
}

.cmd-history-item:active {
  background: #21262d;
  border-color: #58a6ff;
}

/* --- Dictation Overlay --- */

.dictation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.dictation-panel {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 14px;
  padding: 1rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dictation-close {
  background: none;
  border: none;
  color: #484f58;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 0.3rem;
  -webkit-appearance: none;
}

.dictation-status {
  font-size: 0.8rem;
  color: #3fb950;
  text-align: center;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.dictation-text {
  width: 100%;
  min-height: 80px;
  max-height: 200px;
  resize: vertical;
  padding: 0.75rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 16px;
  line-height: 1.5;
  outline: none;
  -webkit-appearance: none;
}

.dictation-text:focus {
  border-color: #58a6ff;
}

.dictation-actions {
  display: flex;
  gap: 0.5rem;
}

.dictation-btn {
  flex: 1;
  padding: 0.6rem;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  transition: background 0.15s, transform 0.1s;
}

.dictation-btn:active {
  transform: scale(0.97);
}

.dictation-cancel {
  background: #21262d;
  color: #8b949e;
}

.dictation-cancel:active {
  background: #30363d;
}

.dictation-send {
  background: #238636;
  color: #fff;
}

.dictation-send:active {
  background: #2ea043;
}

/* --- Mobile keyboard open: hide inactive pane --- */

body.keyboard-open #panes-container.dual .pane:not(.active) {
  display: none;
}

body.keyboard-open #panes-container.dual .pane.active {
  flex: 1;
}

/* --- Mobile breakpoint --- */

@media (max-width: 480px) {
  #picker-view {
    padding: 1.25rem 0.75rem 2rem;
  }

  h1 {
    font-size: 1.15rem;
  }

  .session-card {
    padding: 0.7rem 0.75rem;
  }

  .session-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 0.6rem;
  }

  .session-icon.waiting {
    font-size: 0.85rem;
  }

  .session-name {
    font-size: 0.9rem;
  }

  .terminal-header {
    padding: 0.35rem 0.5rem;
    min-height: 2.3rem;
  }

  #session-label {
    font-size: 0.8rem;
  }

  .terminal-header-left button,
  .terminal-header-right button {
    font-size: 0.7rem;
    padding: 0.35rem 0.55rem;
  }

  .quick-commands button {
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
    min-width: 2.2rem;
  }
}
