* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Brand: red + gunship gray + black */
  --brand-red: #E11D2E;
  --brand-red-bright: #FF5A64;
  --brand-red-deep: #8E101C;
  --gunship: #4C5458;
  --gunship-mid: #6A7276;
  --gunship-light: #9AA1A5;
  --bg: #000000;
  --surface: #141414;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #6ea8fe;
  --rail-w: 280px;
  --header-h: 56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100dvh;
}

.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr var(--rail-w);
  height: 100%;
}

.rail {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(0);
  transition: transform 0.25s ease;
}

.rail-right { border-right: none; border-left: 1px solid var(--border); }

.rail-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.rail-logo, .logo-mark.rail-logo { width: 28px; height: 28px; display: block; flex-shrink: 0; }
.rail-title { font-weight: 600; font-size: 15px; flex: 1; }
.rail-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.rail-nav { padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  background: none; border: none; color: var(--muted); text-align: left;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.nav-item.active, .nav-item:hover { background: var(--border); color: var(--text); }
.rail-body { padding: 16px; overflow-y: auto; }
.rail-empty { color: var(--muted); font-size: 13px; }

.chat { display: flex; flex-direction: column; min-width: 0; }
.chat-header {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.chat-title { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.menu-btn { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; padding: 4px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.ara { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }

.chat-input {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input textarea {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text); padding: 10px 16px;
  font-size: 14px; resize: none; max-height: 120px; outline: none;
  font-family: inherit;
}
.chat-input textarea:focus { border-color: var(--accent); }
.chat-input button, .chat-input .send-btn {
  background: linear-gradient(165deg, var(--brand-red-bright) 0%, var(--brand-red) 46%, var(--gunship) 100%);
  border: none; color: #fff; border-radius: 20px;
  padding: 10px 20px; cursor: pointer; font-size: 14px; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 8px rgba(225, 29, 46, 0.35);
}
.chat-input button:hover, .chat-input .send-btn:hover {
  filter: brightness(1.08);
}

.backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 40; opacity: 0; transition: opacity 0.25s ease;
}
.backdrop.open { display: block; opacity: 1; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; top: 0; bottom: 0; z-index: 50;
    width: min(var(--rail-w), 85vw);
  }
  .rail-left { left: 0; transform: translateX(-100%); }
  .rail-right { right: 0; transform: translateX(100%); }
  .rail.open-left { transform: translateX(0); }
  .rail.open-right { transform: translateX(0); }
  .menu-btn { display: block; }
  .chat-input { z-index: 60; position: relative; background: var(--bg); }
  .app.rail-open .chat-input {
    transform: translateY(0);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.6);
  }
  .app.rail-open .chat {
    padding-bottom: 0;
  }
}
@media (min-width: 901px) {
  .menu-btn { display: none; }
  .rail-close { display: none; }
}