:root {
  --bg: #07131d;
  --bg-2: #0e1f2c;
  --panel: rgba(11, 23, 34, 0.85);
  --panel-2: rgba(16, 30, 42, 0.96);
  --card: rgba(18, 34, 46, 0.92);
  --line: rgba(157, 182, 200, 0.18);
  --line-strong: rgba(157, 182, 200, 0.32);
  --text: #edf6fe;
  --muted: #9ab4c8;
  --accent: #7fe7c4;
  --accent-2: #7cb7ff;
  --accent-3: #d7ccff;
  --success: #74f2b1;
  --warning: #ffca6d;
  --danger: #ff8585;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.38);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 183, 255, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(127, 231, 196, 0.16), transparent 24%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 18px;
}

button, select, textarea, input {
  font: inherit;
}

.app-shell {
  width: min(1500px, 100%);
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: rgba(8, 19, 28, 0.7);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  background: rgba(10, 19, 31, 0.85);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #062b38;
  font-weight: 900;
}

.brand-name {
  font-size: 1.04rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-label {
  padding: 0 10px;
  line-height: 1.3;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
}

.nav-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 11px 12px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(127, 231, 196, 0.08);
  border-color: rgba(127, 231, 196, 0.2);
}

.sidebar-card {
  margin-top: auto;
  padding: 12px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.8rem;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 90px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.page-title {
  margin: 0;
  font-size: clamp(1.2rem, 1.7vw, 2rem);
  letter-spacing: -0.05em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: none;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.status-pill.online {
  color: var(--success);
}

.status-pill.offline {
  color: var(--warning);
}

.status-pill.critical {
  color: var(--danger);
}

.status-pill.info {
  color: var(--accent-2);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 340px;
  flex: 1;
  min-height: 0;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  padding: 18px 18px 10px;
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: min(72%, 720px);
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  line-height: 1.5;
  background: rgba(255,255,255,0.02);
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(124, 183, 255, 0.14), rgba(127, 231, 196, 0.1));
  border-color: rgba(124,183,255,0.3);
}

.message.assistant {
  align-self: flex-start;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.composer textarea {
  flex: 1;
  min-height: 64px;
  max-height: 180px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.composer textarea:focus,
select:focus {
  border-color: rgba(124,183,255,0.6);
  box-shadow: 0 0 0 3px rgba(124,183,255,0.12);
}

.composer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.primary-btn,
.secondary-btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  min-width: 120px;
}

.primary-btn {
  background: linear-gradient(135deg, rgba(127, 231, 196, 0.16), rgba(124, 183, 255, 0.1));
  color: var(--text);
}

.secondary-btn {
  background: rgba(255,255,255,0.02);
  color: var(--text);
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 16px 18px;
  background: rgba(255,255,255,0.01);
}

.panel-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.panel-card h2 {
  margin: 0 0 12px;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

select {
  width: 100%;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  margin-bottom: 8px;
}

.list-row:last-child {
  margin-bottom: 0;
}

.muted-tag {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  margin-bottom: 8px;
  color: var(--text);
}

.toggle-row:last-child {
  margin-bottom: 0;
}

.toggle-row input[type="checkbox"] {
  accent-color: var(--accent);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
