#terminal-window {
  position: fixed;
  z-index: 45;
  display: none;
  flex-direction: column;
}

#terminal-window.is-open { display: flex; }

#terminal-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid #23242b;
  background: var(--bg-term);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 40px 90px -40px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(var(--purple-rgb), 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

#terminal-window.is-max #terminal-card { height: 100%; border-radius: 12px; }

#term-titlebar {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #14151b, #0e0f13);
  border-bottom: 1px solid var(--border);
  cursor: move;
  user-select: none;
  flex: 0 0 auto;
  touch-action: none;
}

.term-traffic {
  display: flex;
  gap: 8px;
}

.traffic-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding-bottom: 1px;
  border: none;
  font-family: var(--font);
  transition: filter .15s;
}

.traffic-btn:hover { filter: brightness(1.18); }

.traffic-close  { background: #f0726b; color: #5b0f0c; }
.traffic-min    { background: #e8c06e; color: #6b4f0c; padding-bottom: 2px; }
.traffic-max    { background: #65d6a6; color: #0c5b3c; font-size: 9px; }

#term-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

#term-dims {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#term-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#terminal-window.is-min #term-content { display: none; }

#term-body {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 20px 16px;
  font-size: 13.5px;
  line-height: 1.62;
  cursor: text;
  background: radial-gradient(120% 80% at 50% 0%, rgba(var(--purple-rgb), 0.05), transparent 60%);
  flex: 1 1 auto;
}

#terminal-window.is-max #term-body { flex: 1 1 auto; }

.term-line {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.62em;
}

#term-prompt-row {
  display: flex;
  align-items: center;
  white-space: pre;
  margin-top: 1px;
}

#term-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--term-white);
  font-family: var(--font);
  font-size: 13.5px;
  caret-color: var(--lilac);
  padding: 0;
}

#term-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 16px;
  align-items: center;
  border-top: 1px solid #16171c;
  background: #0a0b0e;
  flex: 0 0 auto;
}

.chips-label {
  font-size: 12px;
  color: #5b5d68;
  margin-right: 2px;
}

.chip-btn {
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--text-code);
  background: #121317;
  border: 1px solid #23242b;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color .15s, color .15s, transform .15s;
}

.chip-btn:hover {
  border-color: var(--purple);
  color: #fff;
  transform: translateY(-2px);
}

.chip-btn .dollar { color: var(--purple); }

#term-grip {
  height: 15px;
  background: linear-gradient(180deg, #0d0e12, #0a0b0e);
  border-top: 1px solid var(--border);
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  flex: 0 0 auto;
  transition: background .15s;
}

#term-grip:hover { background: #14151b; }

#terminal-window.is-max #term-grip { display: none; }

.grip-handle {
  width: 34px;
  height: 3px;
  border-radius: 2px;
  background: #2f3038;
}
