:root{
  --bg:#0b0f14;
  --card:#101826;
  --muted:#94a3b8;
  --text:#e5e7eb;
  --line:#1f2a3a;
  --accent:#4f46e5;
  --warn:#fbbf24;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11pt;
  color: var(--text);
  background: var(--bg);
}

.topbar{
  position: sticky;
  top:0;
  z-index: 10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(11,15,20,0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand-title{ font-weight: 700; font-size: 16px; }
.brand-subtitle{ color: var(--muted); font-size: 12px; }

.layout{
  display:grid;
  grid-template-columns: 280px 1fr 380px;
  min-height: calc(100vh - 56px);
}

.sidebar{
  border-right: 1px solid var(--line);
  padding: 16px;
}

.nav-title{ font-weight:700; margin-bottom: 10px; }
.nav-section{
  margin-top: 14px;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.nav-link{
  display:block;
  color: var(--text);
  text-decoration:none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.nav-link:hover{
  border-color: var(--line);
  background: rgba(255,255,255,0.03);
}

.content{
  padding: 18px;
}

.content-section{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.content-section h1, .content-section h2{
  margin-top: 0;
}

.content-section h3{
  font-size: 15px;
  margin: 12px 0 6px;
  color: var(--text);
}

.content-section p, .content-section li{
  color: var(--muted);
  line-height: 1.55;
}

.content-section ul{
  padding-left: 18px;
  margin: 6px 0;
}

.note{
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.medical-warning{
  border-left: 4px solid var(--warn);
  padding: 10px 12px;
  background: rgba(251,191,36,0.08);
  border-radius: 10px;
}

.report-box{
  margin: 12px 0;
  padding: 14px 16px;
  background: rgba(79,70,229,0.08);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.7;
}
.report-box p{ margin: 4px 0; }

.content-section table{
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}
.content-section th, .content-section td{
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
}
.content-section th{
  background: rgba(79,70,229,0.10);
  color: var(--accent);
  font-weight: 600;
}
.content-section td{ color: var(--muted); }

.ask-box{
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 14px;
}
.ask-title{
  font-weight:700;
  margin-bottom: 8px;
  color: var(--muted);
}

.footer{
  color: var(--muted);
  text-align:center;
  padding: 16px;
}

.btn{
  background: var(--accent);
  border:none;
  color:white;
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:700;
  font-size: 13px;
}
.btn:hover{ filter: brightness(1.05); }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

.chat-panel{
  border-left: 1px solid var(--line);
  background: rgba(16,24,38,0.95);
  display:flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
}

.chat-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
}

.chat-title{ font-weight:700; }
.chat-subtitle{ color: var(--muted); font-size: 12px; }

.icon-btn{
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
}
.icon-btn:hover{ border-color: var(--accent); color: var(--accent); }

.chat-messages{
  padding: 12px;
  overflow:auto;
  flex: 1;
}

.msg{
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
}
.msg.user{
  margin-left: auto;
  background: rgba(79,70,229,0.16);
}
.msg.bot{
  margin-right: auto;
  background: rgba(255,255,255,0.03);
}
.msg.typing{
  margin-right: auto;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-style: italic;
}

.msg.bot p{ margin: 0 0 8px; }
.msg.bot p:last-child{ margin-bottom: 0; }
.msg.bot .md-h3{
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin: 12px 0 4px;
}
.msg.bot .md-h4{
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 10px 0 4px;
}
.msg.bot .md-list{
  margin: 4px 0 8px 16px;
  padding: 0;
  list-style: disc;
}
.msg.bot .md-list li{
  margin: 2px 0;
  line-height: 1.45;
}

.chat-disclaimer{
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.chat-input{
  display:flex;
  gap: 10px;
  padding: 12px;
}
.chat-input input{
  flex:1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.chat-input input:focus{ border-color: var(--accent); }

.topbar-actions{
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-toggle{
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.menu-toggle:hover{ border-color: var(--accent); color: var(--accent); }

@media (max-width: 1100px){
  .layout{ grid-template-columns: 260px 1fr; }
  .chat-panel{
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 380px;
    height: 100vh;
    z-index: 50;
    transform: translateX(100%);
    transition: transform .3s ease;
  }
  .chat-panel.chat-visible{
    transform: translateX(0);
  }
}

@media (max-width: 768px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ display:none; }
  .sidebar.open{ display:block; position:fixed; top:56px; left:0; bottom:0; width:280px; z-index:40; background:var(--bg); overflow-y:auto; }
  .menu-toggle{ display:inline-flex; }
  .chat-panel{ width:100%; }
}
