:root {
  --bg: #05030a;
  --bg-alt: #0b0614;
  --accent: #ff4b9b;
  --accent-soft: #ff9fd0;
  --text: #fdf7ff;
  --text-muted: #c9b8d8;
  --border: #2a1b3d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: radial-gradient(circle at top, #ff4b9b22, #05030a 55%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 24px;
}

.app {
  width: 100%;
  max-width: 1100px;
  background: linear-gradient(135deg, #0b0614, #12081f);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  background: radial-gradient(circle at top, #ff4b9b22, #090313 60%);
  border-right: 1px solid var(--border);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: conic-gradient(from 200deg, #ff4b9b, #ff9fd0, #ff4b9b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #05030a;
  font-weight: 700;
  font-size: 18px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-text span:first-child {
  font-size: 15px;
  font-weight: 600;
}

.brand-text span:last-child {
  font-size: 12px;
  color: var(--text-muted);
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 10px;
  margin-bottom: 6px;
}

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

.nav button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
}

.nav button span.icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 75, 155, 0.12);
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 11px;
  color: var(--text-muted);
}

/* Main */
.main {
  display: flex;
  flex-direction: column;
  padding: 20px 22px;
  gap: 16px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
}

.header-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #3ddc97;
  box-shadow: 0 0 8px rgba(61, 220, 151, 0.8);
}

/* Panels */
.panel {
  flex: 1;
  display: none;
  flex-direction: column;
  gap: 12px;
}

.panel.active {
  display: flex;
}

/* Chat panel */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: radial-gradient(circle at top left, #ff4b9b10, #05030a 60%);
  padding: 12px;
  overflow: hidden;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.avatar.ai {
  background: conic-gradient(from 200deg, #ff4b9b, #ff9fd0, #ff4b9b);
  color: #05030a;
  font-weight: 700;
}

.avatar.user {
  background: #1b1028;
  color: var(--text-muted);
}

.bubble {
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.bubble.ai {
  background: rgba(255, 75, 155, 0.12);
  border: 1px solid rgba(255, 75, 155, 0.35);
  color: var(--text);
}

.bubble.user {
  background: #1b1028;
  border: 1px solid #2a1b3d;
  color: var(--text);
}

.input-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.input-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #090313;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.input-row input::placeholder {
  color: var(--text-muted);
}

.input-row button {
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #ff4b9b, #ff9fd0);
  color: #05030a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 75, 155, 0.4);
  transition: transform 0.1s, box-shadow 0.1s;
}

.input-row button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(255, 75, 155, 0.5);
}

.input-row button:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(255, 75, 155, 0.35);
}

/* Settings panel */
.settings-group {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  background: #090313;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.settings-group-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.settings-label {
  color: var(--text-muted);
  font-size: 12px;
}

.toggle {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: #1b1028;
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--text-muted);
  transition: transform 0.15s, background 0.15s;
}

.toggle.on {
  background: rgba(255, 75, 155, 0.25);
  border-color: rgba(255, 75, 155, 0.6);
}

.toggle.on .toggle-knob {
  transform: translateX(14px);
  background: #ff4b9b;
}

/* About panel */
.about-card {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  background: #090313;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.about-card h3 {
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}

/* Appended Custom Layout Rule Block */
.card {
  max-width: 620px;
  margin: 0 auto;
  padding: 16px;
  border: 1px solid lightgray;
  border-radius: 16px;
}

.card p:last-child {
  margin-bottom: 0;
}

/* Responsive constraints rule map */
@media (max-width: 800px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
  }
}
