:root {
  color-scheme: dark;
  font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background-color: #05070a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: radial-gradient(circle at top left, #0f172a, #05070a 58%),
    radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.22), transparent);
  color: #e2e8f0;
  padding: 28px;
}

button {
  border: none;
  font: inherit;
  cursor: pointer;
  color: inherit;
  background: none;
}

.app {
  width: min(1430px, 100%); /* Increased from 1100px (30% wider) */
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 24px;
  background: rgba(15, 23, 42, 0.65);
  border-radius: 32px;
  padding: 22px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(14px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  padding: 22px;
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.sidebar__title {
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 0;
  color: #cbd5f5;
}

.pill-btn {
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  transition: transform 150ms ease, box-shadow 200ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.pill-btn--accent {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  color: #04100b;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

.pill-btn--accent:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.5);
}

.pill-btn--primary {
  background: linear-gradient(135deg, #3b82f6, #22c55e);
  color: #0b1120;
  padding-inline: 20px;
  font-weight: 700;
  box-shadow: 0 12px 36px rgba(59, 130, 246, 0.55);
}

.pill-btn--primary:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 18px 45px rgba(59, 130, 246, 0.6);
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-list__empty {
  margin: 24px 0;
  padding: 18px;
  border-radius: 16px;
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.65);
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(51, 65, 85, 0.6);
}

.session-list__empty[hidden] {
  display: none;
}

.session-card {
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  text-align: left;
  transition: transform 140ms ease, border 140ms ease, background 140ms ease;
  border: 1px solid transparent;
}

.session-card:hover,
.session-card:focus-visible {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(96, 165, 250, 0.6);
  background: rgba(15, 23, 42, 1);
  outline: none;
}

.session-card--active {
  border-color: rgba(96, 165, 250, 0.6);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(8, 23, 45, 0.9));
}

.session-card--attention {
  border-color: rgba(251, 191, 36, 0.75);
  box-shadow: 0 12px 28px rgba(251, 191, 36, 0.22);
}

.session-card__title {
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 1rem;
}

.session-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.session-card__tag {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.16);
  color: rgba(191, 219, 254, 0.88);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  border: 1px solid rgba(37, 99, 235, 0.28);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.18);
}

.session-card__timestamp {
  color: rgba(226, 232, 240, 0.6);
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.9);
  position: relative;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.status-dot--running {
  color: #34d399;
}

.status-dot--awaiting {
  color: #fbbf24;
}

.status-dot--exited {
  color: #94a3b8;
}

.status-dot--unknown,
.status-dot--idle {
  color: #cbd5f5;
}

.status-dot--error {
  color: #f87171;
}

.status-dot--starting,
.status-dot--pending {
  color: #60a5fa;
}

.session {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 26px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.session__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.8);
  background: rgba(10, 16, 28, 0.92);
}

.session__title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.session__subtitle {
  margin: 4px 0 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(148, 163, 184, 0.7);
}

.session__controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 23, 42, 0.8);
  padding: 6px 10px 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(71, 85, 105, 0.8);
  transition: border 140ms ease, background 140ms ease;
}

.toggle__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(203, 213, 225, 0.8);
}

.toggle__switch {
  position: relative;
  width: 40px;
  height: 20px;
  background: rgba(15, 23, 42, 1);
  border-radius: 999px;
  border: 1px solid rgba(71, 85, 105, 0.7);
  display: inline-flex;
  align-items: center;
  padding: 1px;
  transition: background 150ms ease;
}

.toggle__thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #38bdf8);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.7);
  transform: translateX(0);
  transition: transform 180ms ease;
}

.toggle.is-active {
  border-color: rgba(3, 169, 244, 0.65);
  background: rgba(37, 99, 235, 0.3);
}

.toggle.is-active .toggle__switch {
  background: rgba(37, 99, 235, 0.3);
}

.toggle.is-active .toggle__thumb {
  transform: translateX(20px);
}

.console {
  margin: 20px 26px;
  background: #020617;
  border-radius: 20px;
  padding: 18px 22px;
  box-shadow: inset 0 0 0 1px rgba(30, 64, 175, 0.25);
  font-family: "JetBrains Mono", "Fira Code", "SFMono-Regular", Menlo,
    Consolas, monospace;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
  position: relative;
}

.console__content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 220ms ease;
}

.console__content.is-transitioning {
  opacity: 0;
  transform: translateY(12px);
}

.console__empty {
  padding: 18px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px dashed rgba(51, 65, 85, 0.6);
  color: rgba(148, 163, 184, 0.75);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}

.console__log {
  color: #e5e7eb;
  font-size: 0.92rem;
  line-height: 1.55;
  letter-spacing: 0.02em;
}

.console__log--dim {
  color: rgba(148, 163, 184, 0.8);
}

.console__timestamp {
  color: rgba(96, 165, 250, 0.75);
  margin-right: 10px;
}

.console__path {
  color: rgba(59, 130, 246, 0.8);
}

.console__prompt {
  background: rgba(251, 191, 36, 0.08);
  border-left: 4px solid rgba(234, 179, 8, 0.9);
  border-radius: 12px;
  padding: 14px 16px;
  color: #fef3c7;
  box-shadow: inset 0 0 0 1px rgba(234, 179, 8, 0.15);
}

.console__prompt-header {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: rgba(253, 224, 71, 0.9);
  margin-bottom: 10px;
}

.session__heading {
  transition: opacity 180ms ease, transform 220ms ease;
}

.session__heading.is-transitioning {
  opacity: 0;
  transform: translateY(10px);
}

.status-pill {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  border: 1px solid rgba(249, 191, 36, 0.4);
  background: rgba(249, 191, 36, 0.08);
  color: #fcd34d;
  box-shadow: 0 0 22px rgba(249, 191, 36, 0.2);
  transition: background 180ms ease, border 180ms ease, color 180ms ease,
    box-shadow 200ms ease;
}

.status-pill--awaiting {
  border-color: rgba(249, 191, 36, 0.4);
  background: rgba(249, 191, 36, 0.08);
  color: #fcd34d;
  box-shadow: 0 0 22px rgba(249, 191, 36, 0.2);
}

.status-pill--running {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(16, 185, 129, 0.12);
  color: #4ade80;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.22);
}

.status-pill--exited {
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(71, 85, 105, 0.22);
  color: #cbd5f5;
  box-shadow: 0 0 22px rgba(71, 85, 105, 0.2);
}

.status-pill--unknown,
.status-pill--idle {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(71, 85, 105, 0.18);
  color: #cbd5f5;
  box-shadow: 0 0 20px rgba(71, 85, 105, 0.18);
}

.status-pill--starting,
.status-pill--pending {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(37, 99, 235, 0.18);
  color: #93c5fd;
  box-shadow: 0 0 24px rgba(37, 99, 235, 0.24);
}

.status-pill--error {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
  box-shadow: 0 0 26px rgba(248, 113, 113, 0.22);
}

.jump-to-live {
  position: sticky;
  bottom: 14px;
  align-self: flex-end;
  margin-top: auto;
  border-radius: 999px;
  padding: 8px 16px;
  background: rgba(37, 99, 235, 0.75);
  color: #e2e8f0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.55);
  display: none;
}

.jump-to-live.is-visible {
  display: inline-flex;
}

.input-bar {
  padding: 16px 26px 22px;
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.98),
    rgba(15, 23, 42, 1)
  );
  border-top: 1px solid rgba(30, 64, 175, 0.4);
  box-shadow: 0 -18px 36px rgba(0, 0, 0, 0.65);
}

.input-bar__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 26px;
  width: 100%;
}

.input-shell {
  position: relative;
  width: 100%;
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chip {
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.9);
  font-size: 0.84rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.chip:hover,
.chip:focus-visible {
  background: rgba(30, 64, 175, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(30, 64, 175, 0.45);
  outline: none;
}

.action-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.quick-actions--stacked {
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.quick-actions__row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.input-bar__input {
  width: 100%;
  border-radius: 28px;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 1);
  border: 1px solid rgba(51, 65, 85, 1);
  color: #e2e8f0;
  font-size: 0.95rem;
  line-height: 1.55;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.9);
  transition: border 150ms ease, box-shadow 180ms ease;
  min-height: 96px;
  resize: vertical;
}

.input-bar__input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.45);
}

.action-cluster__send {
  width: 100%;
  min-width: 140px;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  body {
    padding: 16px;
  }

  .app {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .sidebar {
    order: 2;
  }

  .session {
    order: 1;
  }

  .input-bar__form {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .action-cluster {
    width: 100%;
  }

  .quick-actions--stacked {
    align-items: center;
  }

  .quick-actions__row {
    justify-content: center;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background-color: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid #333;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: #999;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  flex: 1;
}

.modal-subtitle {
  margin: 0 0 20px 0;
  color: #aaa;
  font-size: 0.9rem;
}

.folder-selector {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.folder-list-container,
.folder-create-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.folder-list-container label,
.folder-create-container label {
  font-size: 0.9rem;
  color: #aaa;
  font-weight: 500;
}

.folder-select {
  padding: 10px 12px;
  background-color: #222;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  font-size: 0.95rem;
  font-family: monospace;
}

.folder-select:focus {
  outline: none;
  border-color: #4a9eff;
  background-color: #222;
}

.folder-input-group {
  display: flex;
  gap: 8px;
}

.folder-input {
  flex: 1;
  padding: 10px 12px;
  background-color: #222;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  font-size: 0.95rem;
  font-family: monospace;
}

.folder-input:focus {
  outline: none;
  border-color: #4a9eff;
  background-color: #222;
}

.folder-icon-btn {
  padding: 10px 12px;
  background-color: #333;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
}

.folder-icon-btn:hover {
  background-color: #444;
}

.folder-icon-btn:active {
  background-color: #555;
}

.modal-error {
  padding: 12px;
  background-color: #3d1f1f;
  border: 1px solid #6b3333;
  border-radius: 4px;
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-top: 12px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #333;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background-color: #4a9eff;
  color: #fff;
}

.btn-primary:hover {
  background-color: #3a8eef;
}

.btn-primary:active {
  background-color: #2a7edf;
}

.btn-secondary {
  background-color: #333;
  color: #aaa;
}

.btn-secondary:hover {
  background-color: #444;
  color: #fff;
}

/* Xterm.js Terminal Styles */
#terminal {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
}

.console__content {
  background-color: #0a0a0a;
}

/* Override xterm defaults to match our theme */
.xterm {
  height: 100%;
  padding: 12px;
}

.xterm-viewport {
  background-color: #0a0a0a !important;
}

.xterm-screen {
  background-color: #0a0a0a !important;
}
