:root{
  /* Professional Climate Law Palette */
  --primary: #1f6b35;        /* Forest Green - Environmental */
  --primary-dark: #0f4620;   /* Dark Forest */
  --primary-light: #4a9d5f;  /* Light Green */
  --accent: #d97706;         /* Warm Earth Amber */
  --accent-light: #fbbf24;   /* Light Amber */
  --secondary: #475569;      /* Slate Gray */
  --secondary-light: #64748b; /* Light Slate */
  --green: #16a34a;          /* Climate Green */
  --teal: #0d9488;           /* Teal accent */
  
  /* UI Colors */
  --bg: #f8faf5;             /* Off-white with green tint */
  --card: #ffffff;
  --ink: #1e293b;            /* Dark charcoal */
  --ink-muted: #64748b;      /* Muted slate */
  --danger: #ef4444;
  
  /* Semantic Colors */
  --primary-weak: rgba(31, 107, 53, 0.1);
  --accent-weak: rgba(217, 119, 6, 0.1);
  --success-weak: rgba(22, 163, 74, 0.1);
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
}

/* ============ NEW UNEP-STYLE LAYOUT ============ */
.app-shell{max-width:1200px}
.topbar{
  position: sticky;
  top: 0;
  z-index: 1000;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 16px;
  margin-bottom:0;
  background:linear-gradient(135deg,var(--primary-dark) 0%,var(--primary) 100%);
  color:#fff;
  border-radius:0;
  box-shadow:0 4px 16px rgba(31, 107, 53, 0.15);
  border-bottom:3px solid var(--accent);
}
.orgmark{display:flex;align-items:center;gap:12px}
.orglogo{
  width:56px;
  height:56px;
  border-radius:14px;
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.22);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden; /* important: lets the image fill + crop nicely */
}

.orglogo-img{
  width:100%;
  height:100%;
  object-fit:contain;          /* show full logo (no cropping) */
  object-position:center;
  display:block;
  box-sizing:border-box;
  padding:0px;                /* optional breathing room so it doesn't touch edges */
}


.orgname{font-weight:700;font-size:13px;line-height:1.2}
.orgsub{font-size:12px;opacity:.9}
.topbar-right{display:flex;gap:18px;align-items:center;flex-wrap:wrap}
.toplink{
  color:#fff;
  text-decoration:none;
  font-weight:700;
  font-size:14px;
  opacity:.92;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
}
.toplink:hover{
  opacity: 1;
  background: rgba(255,255,255,.15);
  text-decoration:none;
}
.toplink.active{
  background: var(--accent);
  opacity: 1;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}
.toplink.active::after{
  content: '';
  position: absolute;
  bottom: -11px;
  left: 8px;
  right: 8px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.shell{
  display:grid;
  grid-template-columns:320px 1fr;
  gap:16px;
}

/* Sidebar */
.sidebar{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  box-shadow:0 8px 24px rgba(2,6,23,.05);
}
.sidebar-title{font-size:18px;font-weight:800;margin-bottom:6px}
.sidebar-tag{font-size:13px;color:var(--ink-muted);margin-bottom:12px}

.sidebtn{
  width:100%;
  border:0;
  background:var(--primary);
  color:#fff;
  padding:12px 14px;
  border-radius:12px;
  font-weight:700;
  cursor:pointer;
  margin-bottom:12px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(31, 107, 53, 0.15);
}
.sidebtn:hover{
  background: var(--primary-light);
  box-shadow: 0 6px 16px rgba(31, 107, 53, 0.25);
}

/* Chat History Styles */
.chat-history{
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.chat-history-header{
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.chat-list{
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.chat-list::-webkit-scrollbar{
  width: 4px;
}

.chat-list::-webkit-scrollbar-track{
  background: transparent;
}

.chat-list::-webkit-scrollbar-thumb{
  background: var(--border);
  border-radius: 2px;
}

.chat-item{
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: rgba(31, 107, 53, 0.05);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
}

.chat-item:hover{
  background: rgba(31, 107, 53, 0.1);
  border-color: var(--primary-weak);
}

.chat-item.active{
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}

.chat-item-title{
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-item-preview{
  font-size: 11px;
  color: var(--ink-muted);
  opacity: 0.8;
}

.chat-item.active .chat-item-preview{
  color: rgba(255, 255, 255, 0.8);
}

.chat-item-delete{
  float: right;
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
  opacity: 0.6;
}

.chat-item:hover .chat-item-delete{
  opacity: 1;
}

.chat-item-delete:hover{
  color: var(--danger);
}

.chat-item-actions-btn{
  float:right;
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:#ffffff;
  border:1px solid rgba(31,107,53,.22);
  color:var(--primary);
  font-size:12px;
  cursor:pointer;
  padding:5px 9px;
  margin-left:8px;
  border-radius:999px;
  opacity:1;
  font-weight:800;
  box-shadow:0 2px 8px rgba(15,23,42,.08);
}

.chat-item:hover .chat-item-actions-btn{
  background:rgba(31,107,53,.08);
  border-color:rgba(31,107,53,.4);
  transform:translateY(-1px);
}

.chat-item.active .chat-item-actions-btn{
  background:#ffffff;
  color:var(--primary);
  border-color:rgba(255,255,255,.92);
  box-shadow:0 2px 10px rgba(2,6,23,.18);
}

.chat-item.active:hover .chat-item-actions-btn{
  background:#f3fdf6;
  color:var(--primary);
  border-color:#ffffff;
}

.chat-item-actions-btn:focus-visible{
  outline:2px solid rgba(31,107,53,.3);
  outline-offset:2px;
}

.chat-item-actions-icon{
  font-size:11px;
  line-height:1;
}

.chat-item-actions-label{
  font-size:11px;
  letter-spacing:.2px;
}

.chat-item-actions-menu{
  position:absolute;
  top:30px;
  right:26px;
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:144px;
  padding:8px;
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:12px;
  box-shadow:0 12px 28px rgba(15,23,42,.12);
  z-index:25;
}

.chat-item-actions-menu[hidden]{
  display:none;
}

.chat-item-action{
  appearance:none;
  border:1px solid #cbd5e1;
  background:#fff;
  color:var(--ink);
  border-radius:10px;
  padding:8px 10px;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
  text-align:left;
}

.chat-item-action:hover{
  background:#f8fafc;
}

.sidecard{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  margin-bottom: 12px;
}
.sidecard-muted{background:#f8fafc}
.sidecard-h{font-weight:800;font-size:13px;margin-bottom:8px}
.sideselect{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #cbd5e1;
  outline:none;
}
.sideselect:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(31, 107, 53, .18)}

.tribox{margin-top:12px}
.sidelabel{display:block;font-size:12px;font-weight:700;margin-bottom:6px;color:var(--ink-muted)}
.sidetextarea{
  width:100%;
  padding:12px;
  border-radius:14px;
  border:1px solid #cbd5e1;
  background:#fff;
  color:var(--ink);
  outline:none;
  resize:vertical;
}
.sidetextarea:focus{border-color:var(--green);box-shadow:0 0 0 3px rgba(22,163,74,.18)}
.sidehint{font-size:12px;color:var(--ink-muted);margin-top:10px}
.sidecopy{font-size:13px;color:var(--ink-muted)}

/* Main */
.main{display:flex;flex-direction:column;gap:12px}
.hero{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px 16px;
  box-shadow:0 8px 24px rgba(2,6,23,.05);
}
.hero-mark{display:flex;align-items:center;gap:10px}
.hero-badge{
  padding:6px 10px;
  border-radius:999px;
  background:rgba(31, 107, 53, .12);
  color:var(--primary);
  border:1px solid rgba(31, 107, 53, .28);
  font-weight:800;
  font-size:12px;
}
.hero-title{font-weight:900;font-size:20px}
.hero-sub{margin-top:6px;color:var(--ink-muted);font-size:13px}

.chatpanel{
  height:58vh;
  overflow:auto;
  background:var(--card);
  border:1px solid var(--border);
  padding:16px;
  border-radius:16px;
  box-shadow:0 8px 24px rgba(2,6,23,.05);
}

/* Composer */
.composer{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  background:var(--card);
  border:1px solid var(--border);
  padding:12px;
  border-radius:16px;
  box-shadow:0 8px 24px rgba(2,6,23,.05);
}
#prompt{flex:1;min-width:240px}
.primary{
  background:var(--primary);
  color:#fff;
  border:0;
  padding:12px 16px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(31, 107, 53, 0.15);
}
.primary:hover{
  background: var(--primary-light);
  box-shadow: 0 6px 16px rgba(31, 107, 53, 0.25);
}

#editBadge{
  display:none;
  padding:8px 10px;
  border-radius:999px;
  background:rgba(22,163,74,.10);
  color:var(--green);
  font-size:12px;
  font-weight:700;
  border:1px solid rgba(22,163,74,.28);
}

.footerbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 4px;
  color:var(--ink-muted);
  font-size:12px;
}
.footerbar a{color:var(--primary);text-decoration:none;font-weight:700}
.footerbar a:hover{text-decoration:underline}

/* Responsive */
@media (max-width: 980px){
  .shell{grid-template-columns:1fr}
  .chatpanel{height:52vh}
}
.app{max-width:1200px;margin:0 auto;padding:0 16px;padding-top:14px}
header{background:var(--card);padding:16px 20px;border-radius:16px;box-shadow:0 8px 24px rgba(2,6,23,.05);margin-bottom:16px}
h1{margin:0 0 6px 0;font-size:22px}
header p{margin:0;color:var(--ink-muted);font-size:14px}

#chat{height:60vh;overflow:auto;background:var(--card);padding:16px;border-radius:16px;box-shadow:0 8px 24px rgba(2,6,23,.05)}
.msg{max-width:78%;margin:10px 0;padding:12px 14px;border-radius:14px;white-space:pre-wrap}
.msg.user{margin-left:auto;background:#e0ecff}
.msg.bot{margin-right:auto;background:#f6f7fb}
.msg.sys{background:#f0f9ff;border:1px dashed #bae6fd}
.msg.thinking{opacity:.7;font-style:italic}
.sources{color:var(--ink-muted);font-size:12px;margin:6px 0 12px}
.sources ul{margin:8px 0 0 0;padding-left:18px}
.sources li{margin:6px 0;line-height:1.45}
.sources a{
  color:var(--primary);
  font-weight:800;
  text-decoration:none;
}
.sources a:hover{text-decoration:underline}
.source-label{
  display:inline-flex;
  align-items:center;
  margin-left:8px;
  padding:2px 8px;
  border-radius:999px;
  background:#fff7cc;
  border:1px solid #fde68a;
  color:#7c2d12;
  font-size:11px;
  font-weight:800;
}
.source-section{color:var(--ink-muted)}
.answer-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin:4px 0 12px;
  max-width:78%;
  position:relative;
}
.answer-action-btn,
.answer-share-option{
  appearance:none;
  border:1px solid #cbd5e1;
  background:#fff;
  color:var(--ink);
  border-radius:999px;
  padding:7px 12px;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
}
.answer-action-btn:hover,
.answer-share-option:hover{
  background:#f8fafc;
}
.answer-share-menu{
  position:absolute;
  top:100%;
  left:96px;
  margin-top:8px;
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:148px;
  padding:8px;
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:12px;
  box-shadow:0 12px 28px rgba(15,23,42,.12);
  z-index:20;
}
.answer-share-menu[hidden]{
  display:none;
}

#composer{display:flex;gap:8px;margin-top:16px;align-items:center;flex-wrap:wrap}
#prompt{flex:1;padding:12px 14px;border-radius:12px;border:1px solid #cbd5e1;outline:none}
#prompt:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(31, 107, 53,.2)}
#send{background:var(--primary);color:#fff;border:0;padding:12px 16px;border-radius:12px;cursor:pointer;transition:all 0.2s ease;box-shadow:0 4px 12px rgba(31, 107, 53, 0.15)}
#send:hover{background:var(--primary-light);box-shadow:0 6px 16px rgba(31, 107, 53, 0.25)}
#send:disabled{cursor:not-allowed;opacity:.74;box-shadow:none}
.msg.thinking{display:flex;align-items:center;gap:10px;color:#334155;background:#f8fafc;border:1px solid #dbe5ef}
.msg.thinking::before{content:"";width:14px;height:14px;border:2px solid #cbd5e1;border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
#newChat{
  background:#fff;
  color:var(--danger);
  border:1px solid #fecaca;
  padding:12px 14px;
  border-radius:12px;
  cursor:pointer;
  font-weight:600;
}
#newChat:hover{background:#fff5f5}

#editBadge{
  display:none;
  padding:8px 10px;
  border-radius:999px;
  background:var(--primary-weak);
  color:var(--primary);
  font-size:12px;
  font-weight:600;
  border:1px solid rgba(31, 107, 53,.25);
}


/* Professional banner with green theme */
.banner{background:var(--primary); color:#fff; padding:14px 18px; border-radius:14px; box-shadow:0 8px 24px rgba(31, 107, 53,.25); margin-bottom:16px;}
.banner .brand{font-weight:700; letter-spacing:.2px; font-size:18px;}
.banner .tag{opacity:.9; font-size:13px;}

.message.bot {align-self: flex-start; background-color: var(--bot-msg); text-align: left; margin-left: 10px; margin-right: auto; word-wrap: break-word; max-width: 95%; padding: 1rem; border-radius: 10px; white-space: pre-wrap;}

.topnav { 
  display:flex; gap:18px; margin-bottom:12px; 
  padding:10px; background:#fff; border-radius:12px;
  box-shadow:0 4px 14px rgba(0,0,0,.05);
}
.topnav a { text-decoration:none; color:#2563eb; font-weight:500; }
.topnav a:hover { text-decoration:underline; }

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  padding:9px 14px;
  border:1px solid transparent;
  background:var(--primary);
  color:#fff;
  font-size:13px;
  font-weight:800;
  text-decoration:none;
}
.btn.secondary{
  background:#fff;
  color:var(--ink);
  border-color:#cbd5e1;
}
.btn:hover{text-decoration:none;filter:brightness(.98)}

.source-excerpt-panel{
  margin:16px auto 18px;
  padding:22px;
  max-width:980px;
  background:#fffdf2;
  border:1px solid #fde68a;
  border-left:6px solid #facc15;
  border-radius:18px;
  box-shadow:0 18px 40px rgba(120, 53, 15, .12);
}
.source-excerpt-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:8px;
}
.source-excerpt-kicker{
  color:#92400e;
  font-size:12px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.source-excerpt-label{
  display:inline-flex;
  align-items:center;
  padding:5px 10px;
  border-radius:999px;
  background:#fef3c7;
  color:#7c2d12;
  border:1px solid #fcd34d;
  font-size:12px;
  font-weight:900;
}
.source-excerpt-panel h2{
  margin:0 0 8px;
  font-size:22px;
  color:#111827;
}
.source-excerpt-section{
  margin:0 0 12px;
  color:#475569;
  font-size:13px;
  font-weight:700;
}
.source-highlight{
  display:block;
  padding:16px;
  background:#fef08a;
  color:#1f2937;
  border-radius:14px;
  line-height:1.7;
  white-space:pre-wrap;
  box-decoration-break:clone;
}
.source-excerpt-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
}

.library-header p{
  color: var(--ink-muted);
  margin-top: 6px;
}

.library-filters{
  display:grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin: 18px 0 12px;
}

.library-filters input,
.library-filters select{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.library-summary{
  margin-bottom: 10px;
  color: var(--ink-muted);
  font-size: 14px;
}

.doc-table {width: 100%; border-collapse: collapse; margin-top: 20px;}
.doc-table th, .doc-table td {border-bottom: 1px solid #e2e8f0; padding: 12px 8px; text-align: left;}
.doc-name{ word-break: break-word; }
.doc-actions{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
}
.doc-actions a{
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.doc-actions a:hover{
  text-decoration: underline;
}

/* Responsive layout */
@media (max-width: 600px) {
  .app {max-width: 100%; padding: 0 10px;}
  #chat {height: 50vh;}
  .library-filters{ grid-template-columns: 1fr; }
  .msg {max-width: 90%; font-size: 14px;}
  .answer-actions{max-width:90%;}
  .answer-share-menu{left:0;}
  .msg.user{cursor:pointer}
  .msg.user:hover{outline:2px solid rgba(37,99,235,.18)}
  header.banner .brand {font-size: 16px;}
  header.banner .tag {font-size: 12px;}
}
.full-width {max-width: 100%; width: 100%; margin: 0; padding: 0;}
.pdf-container {background: white; padding: 0; margin-top: 12px; border-radius: 0; box-shadow: none; height: calc(100vh - 140px);}
.pdf-container embed {width: 100%; height: 100%; border-radius: 12px;}

.audio-controls{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin-top:10px;
}

.audio-btn{
  border:1px solid #cbd5e1;
  background:#fff;
  padding:9px 10px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
  font-size:12px;
}

.audio-btn:disabled{
  opacity:.5;
  cursor:not-allowed;
}

.audio-status{
  font-size:12px;
  color:var(--ink-muted);
}

.tool-mode-sidebar-note{
  display:grid;
  gap:6px;
}

.legacy-mode-card{
  display:none !important;
}

.tool-mode-card{
  display:grid;
  grid-template-columns:minmax(180px,.45fr) minmax(260px,1fr);
  gap:14px 18px;
  align-items:center;
  margin:0 0 14px;
  padding:16px;
  border:1px solid #d9e6df;
  border-radius:16px;
  background:linear-gradient(135deg,#ffffff 0%,#f4fbf7 100%);
  box-shadow:0 12px 28px rgba(15,23,42,.06);
}
.tool-mode-copy{
  display:grid;
  gap:3px;
}
.tool-mode-copy span{
  color:var(--primary);
  font-size:11px;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.tool-mode-copy strong{
  color:var(--ink);
  font-size:15px;
  line-height:1.3;
}
.tool-mode-controls{
  display:grid;
  gap:10px;
}
.tool-mode-controls .sideselect{
  width:100%;
  min-height:44px;
  border-radius:12px;
  border-color:#cbd5e1;
  background:#fff;
}
.tool-mode-card .audio-controls{
  margin-top:0;
}
.tool-mode-card .audio-btn{
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-height:36px;
  border-radius:999px;
  background:#fff;
}
.tool-mode-card .audio-btn span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:28px;
  height:20px;
  padding:0 6px;
  border-radius:999px;
  color:#fff;
  background:var(--primary);
  font-size:9px;
  font-weight:900;
}
.tool-tribunal-box{
  grid-column:1 / -1;
  padding:14px;
  border:1px solid #dbe5ef;
  border-radius:14px;
  background:#fff;
}
.tool-mode-hint{
  grid-column:1 / -1;
  margin:0;
  color:var(--ink-muted);
  font-size:12px;
  line-height:1.45;
}

/* Polished export/share menus */
.chat-item{
  position:relative;
  padding-right:78px;
}
.chat-item-actions-btn{
  position:absolute;
  top:10px;
  right:12px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:32px;
  padding:7px 10px;
  border:1px solid #c6dcda;
  border-radius:999px;
  color:#075c5d;
  background:#fff;
  box-shadow:0 8px 18px rgba(3,36,45,.08);
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}
.chat-item-actions-btn:hover,
.chat-item-actions-btn[aria-expanded="true"]{
  background:#e9f7f4;
  border-color:#9fcfc7;
}
.chat-item-actions-icon{
  width:0;
  height:0;
  border-left:4px solid transparent;
  border-right:4px solid transparent;
  border-top:5px solid currentColor;
}
.chat-item-actions-menu{
  position:absolute;
  top:48px;
  right:10px;
  z-index:30;
  width:238px;
  min-width:238px;
  padding:8px;
  overflow:hidden;
  border:1px solid #d8e4e3;
  border-radius:10px;
  background:#fff;
  box-shadow:0 16px 32px rgba(3,36,45,.20);
}
.chat-item-actions-menu[hidden],
.session-menu-view[hidden],
.answer-share-menu[hidden]{
  display:none;
}
.session-menu-view{
  display:flex;
  flex-direction:column;
  gap:5px;
}
.session-menu-title,
.answer-share-title{
  padding:5px 7px 8px;
  color:#526375;
  font-size:10px;
  font-weight:850;
  letter-spacing:.1em;
  text-transform:uppercase;
}
.chat-item-action,
.answer-share-option.answer-share-row{
  width:100%;
  border:0;
  border-radius:8px;
  color:#173b47;
  background:#fff;
  font:inherit;
  cursor:pointer;
  text-decoration:none;
}
.session-menu-trigger,
.session-action-row,
.answer-share-option.answer-share-row{
  display:grid;
  grid-template-columns:32px minmax(0,1fr) 12px;
  align-items:center;
  gap:9px;
  min-height:50px;
  padding:8px;
  text-align:left;
}
.session-action-row,
.answer-share-option.answer-share-row{
  grid-template-columns:32px minmax(0,1fr);
}
.session-action-label,
.session-menu-trigger > span:nth-child(2),
.answer-share-row > span:last-child{
  display:flex;
  min-width:0;
  flex-direction:column;
  gap:1px;
}
.session-menu-trigger strong,
.session-action-row strong,
.answer-share-row strong{
  color:#173b47;
  font-size:12px;
  font-weight:850;
  line-height:1.25;
}
.session-menu-trigger small,
.session-action-row small,
.answer-share-row small{
  color:#6a7d89;
  font-size:10px;
  font-weight:600;
  line-height:1.3;
}
.chat-item-action:hover,
.chat-item-action:focus-visible,
.answer-share-option.answer-share-row:hover,
.answer-share-option.answer-share-row:focus-visible{
  color:#064d57;
  background:#e9f7f4;
  outline:none;
}
.session-platform-icon{
  position:relative;
  display:inline-flex;
  width:30px;
  height:30px;
  align-items:center;
  justify-content:center;
  border-radius:8px;
  color:#fff;
  background:#075c5d;
  font-size:10px;
  font-weight:900;
  line-height:1;
  letter-spacing:0;
}
.icon-download,
.icon-share{
  color:#075c5d;
  background:#e6f5f1;
}
.icon-download::before{
  content:"";
  width:7px;
  height:10px;
  border-right:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:translateY(-2px) rotate(45deg);
}
.icon-download::after{
  content:"";
  position:absolute;
  left:8px;
  right:8px;
  bottom:6px;
  border-bottom:2px solid currentColor;
}
.icon-share::before{
  content:"";
  width:9px;
  height:9px;
  border-top:2px solid currentColor;
  border-right:2px solid currentColor;
}
.icon-share::after{
  content:"";
  position:absolute;
  width:10px;
  border-top:2px solid currentColor;
  transform:translate(-2px,2px) rotate(-45deg);
}
.icon-word{background:#2563a9}
.icon-pdf{background:#bf2d24;font-size:8px}
.icon-whatsapp{border-radius:50%;background:#1f9d55;font-size:8px}
.icon-email{background:#c57a16;font-size:16px}
.icon-linkedin{background:#0a66c2;font-family:Arial,sans-serif;font-size:13px}
.icon-copy{background:#526375}
.session-menu-chevron{
  width:7px;
  height:7px;
  justify-self:end;
  border-top:2px solid #78909a;
  border-right:2px solid #78909a;
  transform:rotate(45deg);
}
.session-menu-back{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
  margin-bottom:4px;
  padding:8px 8px 10px;
  border:0;
  border-bottom:1px solid #e4eceb;
  color:#405a67;
  background:#fff;
  font-size:11px;
  font-weight:850;
  text-align:left;
  cursor:pointer;
}
.session-menu-back span{
  width:7px;
  height:7px;
  border-left:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:rotate(45deg);
}
.chat-item-delete{
  position:absolute;
  right:12px;
  bottom:10px;
  display:inline-grid;
  place-items:center;
  width:24px;
  height:24px;
  border:1px solid transparent;
  border-radius:50%;
  color:#7b8794;
  background:transparent;
  cursor:pointer;
}
.chat-item-delete span,
.chat-item-delete span::before{
  display:block;
  width:12px;
  height:2px;
  border-radius:2px;
  background:currentColor;
  transform:rotate(45deg);
}
.chat-item-delete span::before{
  content:"";
  transform:rotate(90deg);
}
.chat-item-delete:hover{
  color:#fff;
  background:#b42318;
  border-color:#d75045;
}
.answer-actions{
  max-width:100%;
  gap:8px;
  margin:6px 0 14px;
}
.answer-action-btn{
  display:inline-flex;
  min-height:36px;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:8px 12px;
  border:1px solid #c6dcda;
  border-radius:999px;
  color:#075c5d;
  background:#fff;
  box-shadow:0 5px 14px rgba(3,36,45,.08);
  font-size:12px;
  font-weight:850;
}
.answer-action-btn:hover,
.answer-action-btn[aria-expanded="true"]{
  color:#063f49;
  background:#e9f7f4;
  border-color:#9fcfc7;
}
.answer-action-icon{
  position:relative;
  display:inline-block;
  width:16px;
  height:16px;
  color:currentColor;
}
.answer-download-icon::before{
  content:"";
  position:absolute;
  left:7px;
  top:1px;
  width:2px;
  height:9px;
  border-radius:2px;
  background:currentColor;
}
.answer-download-icon::after{
  content:"";
  position:absolute;
  left:4px;
  bottom:1px;
  width:7px;
  height:7px;
  border-right:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:rotate(45deg) translate(-1px,-1px);
}
.answer-share-menu{
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  z-index:25;
  display:flex;
  flex-direction:column;
  gap:5px;
  width:248px;
  min-width:248px;
  margin-top:0;
  padding:8px;
  border:1px solid #d8e4e3;
  border-radius:10px;
  background:#fff;
  box-shadow:0 16px 32px rgba(3,36,45,.20);
}

@media (max-width:760px){
  .tool-mode-card{
    grid-template-columns:1fr;
  }
  .chat-item{
    padding-right:14px;
    padding-top:52px;
  }
  .chat-item-actions-menu{
    right:6px;
    width:min(238px,calc(100vw - 56px));
    min-width:0;
  }
  .answer-share-menu{
    width:min(248px,calc(100vw - 48px));
    min-width:0;
  }
}


/* =========================
   LANDING VIEW STYLES
========================= */

/* Ensure the intended wider shell wins over the later `.app{max-width:900px}` rule */
.app.app-shell{max-width:1200px}

/* Landing mode: hide sidebar and let main take full width */
.shell.landing{
  grid-template-columns: 1fr;
}
.shell.landing .sidebar{
  display:none;
}

/* Topbar CTA */
.toplink-cta{
  background: var(--accent);
  border: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 800;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}
.toplink-cta:hover{
  text-decoration:none;
  background: var(--accent-light);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
}

.landing-view{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(2,6,23,.05);
}

.landing-hero{
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  min-height: 300px;
  margin-bottom: 16px;
  box-shadow: 0 10px 28px rgba(2,6,23,.08);
}

.landing-hero-bgimg{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  display:block;
  transform:none;             /* removes the extra zoom that was cropping the image */
}


.landing-hero-overlay{
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(2,6,23,.72) 0%,
    rgba(2,6,23,.42) 55%,
    rgba(2,6,23,.22) 100%
  );
}


/* Copy sits on top */
.landing-copy--onbg{
  position: relative;
  z-index: 2;
  padding: 18px;
  max-width: 760px;
}

.landing-hero .landing-kicker{
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .2px;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: rgba(255,255,255,.86);
}

.landing-hero .landing-title{
  margin: 0 0 8px 0;
  font-size: 30px;
  line-height: 1.15;
  color: #ffffff;
  text-shadow: 0 10px 24px rgba(0,0,0,.25);
}

.landing-hero .landing-sub{
  margin: 0 0 14px 0;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255,255,255,.88);
}

/* Buttons look good on dark hero */
.landing-hero .cta-secondary{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.22);
  color: #ffffff;
}
.landing-hero .cta-secondary:hover{
  filter: none;
  background: rgba(255,255,255,.14);
}

/* Scope box becomes “glass” */
.landing-scope--onbg{
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(6px);
}
.landing-hero .landing-scope-title{
  color: rgba(255,255,255,.92);
}
.landing-hero .landing-scope-text{
  color: var(--ink); /* Make sure text color is visible on a white background */
  font-size: 13px;
  line-height: 1.5;
}

/* Fallback sits above everything if the image fails */
.landing-hero-fallback{
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 18px;
  display: flex;
  align-items: flex-end;
}

.landing-kicker{
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--ink-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.landing-title{
  margin: 0 0 8px 0;
  font-size: 28px;
  line-height: 1.15;
  color: var(--ink);
}

.landing-sub{
  margin: 0 0 14px 0;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.55;
}

.landing-cta{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom: 14px;
}

.cta-primary{
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(31, 107, 53, 0.15);
}
.cta-primary:hover{
  background: var(--primary-light);
  box-shadow: 0 6px 16px rgba(31, 107, 53, 0.25);
}

.cta-secondary{
  display:inline-block;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  background:#fff;
  color: var(--accent);
  text-decoration:none;
  font-weight: 800;
  transition: all 0.2s ease;
}
.cta-secondary:hover{
  background: var(--accent-weak);
  filter:none;
}

.landing-scope{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #f8fafc;
}
.landing-scope-title{
  font-weight: 900;
  font-size: 13px;
  margin-bottom: 6px;
}
.landing-scope-text{
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.5;
}

.landing-media{
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow:hidden;
  background: linear-gradient(180deg, rgba(31, 107, 53,.08), rgba(217, 119, 6,.06));
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 220px;
}

.landing-hero-img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

.landing-hero-fallback{
  padding: 16px;
  width:100%;
}

.fallback-card{
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,.8);
}
.fallback-icon{
  font-size: 20px;
  margin-bottom: 6px;
}
.fallback-text{
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.45;
}
.fallback-text code{
  background: rgba(15,23,42,.06);
  padding: 2px 6px;
  border-radius: 8px;
}

.landing-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.landing-card{
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(2,6,23,.04);
}

.landing-card-wide{
  grid-column: 1 / -1;
}

.landing-card-h{
  font-weight: 900;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--ink);
}

.landing-card-p{
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.landing-timeline{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 6px;
}

.timeline-row{
  display:flex;
  gap: 10px;
  align-items:flex-start;
}

.timeline-dot{
  width:10px;
  height:10px;
  border-radius:999px;
  background: var(--green);
  margin-top: 6px;
  flex: 0 0 auto;
}

.timeline-title{
  font-weight: 900;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 2px;
}

.timeline-text{
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.landing-bottom-cta{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:flex-start;
  flex-wrap:wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 980px){
  .landing-copy--onbg{max-width: 100%}
  .landing-grid{grid-template-columns: 1fr}
}

/* ===========================
   CLIMATE LAW EXPLORER PAGE
===========================*/

/* ===========================
   CLIMATE LAW EXPLORER HERO
===========================*/

.explorer-hero{
position:relative;
overflow:hidden;
border-radius:16px;
min-height:420px;
margin-bottom:24px;
box-shadow:0 12px 34px rgba(2,6,23,.12);
}

/* Background image */
.explorer-hero-bgimg{
position:absolute;
inset:0;
width:100%;
height:100%;
object-fit:cover;
object-position:center;
z-index:1;
}

/* Overlay for readability */
.explorer-hero-overlay{
position:absolute;
inset:0;
background:linear-gradient(
90deg,
rgba(2,6,23,.78) 0%,
rgba(2,6,23,.55) 50%,
rgba(2,6,23,.35) 100%
);
z-index:2;
}

/* Content sits above */
.explorer-inner--onbg{
position:relative;
z-index:3;
max-width:820px;
margin:auto;
padding:70px 24px;
text-align:center;
color:white;
}

.explorer-title{
font-size:48px;
font-weight:900;
margin:12px 0;
color:white;
text-shadow:0 10px 26px rgba(0,0,0,.35);
}

.explorer-sub{
font-size:18px;
line-height:1.6;
opacity:.95;
margin-bottom:26px;
}

.explorer-actions{
display:flex;
gap:14px;
justify-content:center;
flex-wrap:wrap;
}

.explorer-inner{
max-width:900px;
margin:auto;
}

.explorer-title{
font-size:46px;
font-weight:900;
margin:10px 0;
}

.explorer-sub{
font-size:18px;
opacity:.92;
line-height:1.6;
}

.explorer-actions{
margin-top:30px;
display:flex;
gap:14px;
justify-content:center;
flex-wrap:wrap;
}

.explorer-section{
padding:70px 20px;
background:#f6f8fb;
}

.explorer-grid{
display:grid;
grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
gap:24px;
max-width:1100px;
margin:auto;
}

.explorer-card{
background:white;
padding:26px;
border-radius:14px;
box-shadow:0 8px 22px rgba(0,0,0,.08);
}

.explorer-bottom{
text-align:center;
padding:80px 20px;
}

.explorer-launch-large{
font-size:20px;
padding:16px 28px;
}

/* Final chat workspace refinements */
.chat-list,
.sidebar,
.chat-history{
  overflow:visible;
}

.chat-item{
  display:grid;
  gap:4px;
  min-height:78px;
  padding:14px 118px 14px 14px !important;
  overflow:visible !important;
  white-space:normal !important;
}

.chat-item-title,
.chat-item-preview{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}

.chat-item-title{
  padding-right:0;
  line-height:1.25;
}

.chat-item-actions-btn{
  float:none !important;
  position:absolute !important;
  top:14px !important;
  right:46px !important;
  margin:0 !important;
  min-width:86px;
  justify-content:center;
  z-index:4;
}

.chat-item-actions-btn .chat-item-actions-icon{
  font-size:0;
}

.chat-item-actions-btn .chat-item-actions-icon::before{
  content:"";
  display:block;
  width:0;
  height:0;
  border-left:4px solid transparent;
  border-right:4px solid transparent;
  border-top:5px solid currentColor;
}

.chat-item-delete{
  float:none !important;
  position:absolute !important;
  top:14px !important;
  right:12px !important;
  bottom:auto !important;
  margin:0 !important;
  z-index:5;
}

.chat-item-actions-menu{
  top:52px !important;
  right:46px !important;
  z-index:9999 !important;
}

.chat-item.active .chat-item-delete{
  color:rgba(255,255,255,.78);
}

.chat-item.active .chat-item-delete:hover{
  color:#fff;
  background:#b42318;
}

.chatpanel{
  position:relative;
  z-index:1;
}

.tool-mode-card{
  position:relative;
  z-index:8;
}

.tool-tribunal-box{
  display:grid;
  gap:12px;
}

.tribunal-submit-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  padding-top:2px;
}

.tribunal-submit-row span{
  color:var(--ink-muted);
  font-size:12px;
  line-height:1.4;
}

.tribunal-submit-row button{
  border:0;
  border-radius:999px;
  padding:11px 16px;
  color:#fff;
  background:var(--primary);
  box-shadow:0 8px 18px rgba(31,107,53,.18);
  font-weight:850;
  cursor:pointer;
}

.tribunal-submit-row button:hover{
  background:var(--primary-light);
}

@media (max-width:760px){
  .chat-item{
    padding:52px 14px 14px 14px !important;
  }
  .chat-item-actions-btn{
    left:14px !important;
    right:auto !important;
  }
  .chat-item-delete{
    top:18px !important;
    right:14px !important;
  }
  .chat-item-actions-menu{
    left:14px !important;
    right:auto !important;
    width:min(238px,calc(100vw - 56px));
    min-width:0;
  }
}

/* Final production polish: match ClimateAction-style header, export pill, and mobile rhythm. */
body{
  overflow-x:hidden;
}

.app.app-shell{
  width:min(1480px,100%);
  max-width:1480px !important;
  padding:20px;
}

.topbar{
  position:sticky;
  top:12px;
  z-index:5000;
  align-items:center;
  padding:22px 24px !important;
  margin:0 0 24px !important;
  border:0 !important;
  border-bottom:0 !important;
  border-radius:22px !important;
  background:linear-gradient(135deg,#083f47 0%,#07515a 100%) !important;
  box-shadow:0 22px 45px rgba(3,36,45,.18) !important;
}

.orgmark{
  align-items:center;
}

.orglogo{
  width:84px !important;
  height:64px !important;
  padding:7px;
  border-radius:12px !important;
  background:#fff !important;
  border:1px solid rgba(255,255,255,.75) !important;
  box-shadow:0 10px 22px rgba(2,6,23,.16);
}

.orglogo-img{
  width:100%;
  height:100%;
  object-fit:contain;
  padding:0 !important;
}

.orgname{
  max-width:360px;
  color:#fff;
  font-size:18px !important;
  font-weight:900 !important;
  line-height:1.18 !important;
}

.orgsub{
  color:rgba(255,255,255,.82);
  font-size:14px !important;
}

.topbar-right{
  gap:12px !important;
}

.toplink{
  display:inline-flex;
  align-items:center;
  min-height:48px;
  padding:12px 18px !important;
  border:1px solid rgba(255,255,255,.24);
  border-radius:14px !important;
  background:rgba(255,255,255,.06);
  color:#fff !important;
  font-size:15px !important;
  font-weight:850 !important;
}

.toplink.active,
.toplink-cta{
  background:#d97706 !important;
  border-color:#d97706 !important;
  color:#fff !important;
  box-shadow:0 12px 24px rgba(217,119,6,.26) !important;
}

.toplink.active::after{
  bottom:-13px !important;
  left:18px !important;
  right:18px !important;
  height:4px !important;
}

.shell:not(.landing){
  grid-template-columns:minmax(300px,360px) minmax(0,1fr);
  align-items:start;
}

.sidebar{
  position:relative;
  z-index:100;
  background:#083f47;
  border:0;
  color:#fff;
  box-shadow:0 24px 55px rgba(3,36,45,.18);
}

.sidebar-title{
  color:#fff;
  font-size:24px;
  font-weight:950;
}

.sidebar-tag,
.sidebar .sidecopy{
  color:rgba(255,255,255,.74);
  line-height:1.55;
}

.sidebtn{
  background:#f2aa32 !important;
  color:#fff !important;
  border-radius:16px !important;
  box-shadow:none !important;
}

.chat-history{
  border-top-color:rgba(255,255,255,.16);
}

.chat-history-header{
  color:rgba(255,255,255,.82);
  letter-spacing:.08em;
}

.chat-list{
  max-height:none !important;
  overflow:visible !important;
}

.chat-item{
  min-height:112px;
  padding:18px 118px 18px 18px !important;
  border:1px solid rgba(255,255,255,.13) !important;
  border-radius:16px !important;
  background:rgba(255,255,255,.08) !important;
  color:#fff !important;
}

.chat-item:hover{
  background:rgba(255,255,255,.12) !important;
}

.chat-item.active{
  background:#1f6b35 !important;
  border-color:rgba(251,191,36,.55) !important;
}

.chat-item-title{
  color:#fff;
  font-size:14px;
  font-weight:900;
}

.chat-item-preview{
  color:rgba(255,255,255,.72) !important;
  font-size:13px;
  line-height:1.55;
}

.chat-item-actions-btn{
  top:18px !important;
  right:58px !important;
  min-width:98px;
  min-height:38px;
  color:#075c5d !important;
  background:#fff !important;
  border:0 !important;
  border-radius:11px !important;
  box-shadow:0 12px 24px rgba(3,36,45,.18) !important;
}

.chat-item-actions-icon{
  position:relative;
  width:14px !important;
  height:14px !important;
  border:0 !important;
  font-size:0 !important;
}

.chat-item-actions-icon::before{
  content:"";
  position:absolute;
  left:4px;
  top:1px;
  width:2px;
  height:9px;
  border-radius:2px;
  background:currentColor;
}

.chat-item-actions-icon::after{
  content:"";
  position:absolute;
  left:1px;
  bottom:1px;
  width:8px;
  height:8px;
  border-right:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:rotate(45deg) translate(-1px,-1px);
}

.chat-item-actions-btn .chat-item-actions-icon::before{
  border:0 !important;
}

.chat-item-delete{
  top:18px !important;
  right:18px !important;
  width:38px !important;
  height:38px !important;
  color:#d5e8e8 !important;
  background:rgba(255,255,255,.08) !important;
  border:1px solid rgba(255,255,255,.16) !important;
}

.chat-item-delete:hover{
  color:#fff !important;
  background:#b42318 !important;
  border-color:#d75045 !important;
}

.chat-item-actions-menu{
  top:62px !important;
  right:58px !important;
  z-index:99999 !important;
  width:294px !important;
  min-width:294px !important;
  border-radius:0 !important;
  box-shadow:0 24px 45px rgba(3,36,45,.26) !important;
}

.session-menu-title,
.answer-share-title{
  color:#075c5d;
}

.answer-actions{
  position:relative;
  z-index:30;
}

.answer-share-menu{
  z-index:99999 !important;
}

.sidecard{
  background:rgba(255,255,255,.08) !important;
  border-color:rgba(255,255,255,.14) !important;
  color:#fff;
}

.sidecard-h{
  color:#fff;
}

.sidecard-muted{
  background:rgba(255,255,255,.10) !important;
}

.main{
  min-width:0;
}

.tool-mode-card{
  grid-template-columns:minmax(220px,.36fr) minmax(0,1fr);
}

.tribunal-submit-row{
  border-top:1px solid #e4eceb;
  padding-top:14px;
}

@media (max-width:980px){
  .app.app-shell{
    padding:14px;
  }
  .topbar{
    position:relative !important;
    top:auto !important;
    display:grid !important;
    grid-template-columns:1fr;
    gap:18px;
    padding:18px !important;
  }
  .topbar-right{
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;
  }
  .toplink{
    justify-content:center;
    text-align:center;
  }
  .shell:not(.landing){
    grid-template-columns:1fr;
  }
  .sidebar{
    order:1;
  }
  .main{
    order:2;
  }
  .tool-mode-card{
    grid-template-columns:1fr;
  }
}

@media (max-width:640px){
  .app.app-shell{
    padding:10px;
  }
  .orgmark{
    align-items:flex-start;
  }
  .orglogo{
    width:64px !important;
    height:54px !important;
  }
  .orgname{
    font-size:15px !important;
  }
  .topbar-right{
    grid-template-columns:1fr;
  }
  .chat-item{
    min-height:132px;
    padding:66px 18px 18px !important;
  }
  .chat-item-actions-btn{
    left:18px !important;
    right:auto !important;
  }
  .chat-item-delete{
    right:18px !important;
  }
  .chat-item-actions-menu{
    left:18px !important;
    right:auto !important;
    width:min(294px,calc(100vw - 56px)) !important;
    min-width:0 !important;
  }
  .tool-mode-card .audio-controls{
    display:grid;
    grid-template-columns:1fr;
  }
  .tribunal-submit-row{
    align-items:stretch;
    flex-direction:column;
  }
  .tribunal-submit-row button{
    width:100%;
  }
  .composer{
    display:grid;
    grid-template-columns:1fr;
  }
  #prompt{
    min-width:0;
    width:100%;
  }
}

/* Final responsive navigation and source-view polish */
.topbar{
  max-width:100%;
}

.topbar-left,
.topbar-right{
  min-width:0;
}

.topbar-right{
  justify-content:flex-end;
}

.toplink{
  gap:9px;
}

.toplink[href="/"]::before,
.toplink[href="/explorer"]::before,
.toplink[href="/documents"]::before,
.toplink[href="/#tool"]::before,
.toplink[href="#tool"]::before{
  content:"";
  width:16px;
  height:16px;
  flex:0 0 16px;
  border:2px solid currentColor;
  border-radius:4px;
}

.toplink[href="/"]::before{
  border-top:0;
  transform:rotate(45deg);
}

.toplink[href="/explorer"]::before,
.toplink[href="/documents"]::before{
  border-radius:3px;
  box-shadow:inset 6px 0 0 transparent;
}

.toplink[href="/#tool"]::before,
.toplink[href="#tool"]::before{
  border-radius:50%;
  border-top-color:transparent;
}

.sources{
  max-width:min(860px,100%);
  margin:10px 0 18px;
  padding:16px;
  border:1px solid #c9e1dc;
  border-radius:16px;
  color:#40576a;
  background:#eef9f6;
  box-shadow:0 8px 20px rgba(3,36,45,.05);
}

.sources strong{
  display:block;
  margin-bottom:8px;
  color:#40576a;
}

.sources ul{
  display:grid;
  gap:7px;
  margin:0;
}

.sources li{
  color:#43566a;
}

.sources a{
  color:#007285;
  font-weight:900;
}

.source-label{
  margin-left:8px;
  background:#d5f0ec;
  border:0;
  color:#075c5d;
  font-weight:900;
}

.source-section{
  display:none !important;
}

.document-view-shell{
  padding:18px !important;
}

.doc-header{
  padding:22px 24px;
  border:1px solid #d8e4e3;
  border-radius:18px;
  background:#fff;
  box-shadow:0 14px 30px rgba(3,36,45,.08);
}

.doc-header h1{
  margin:0 0 14px;
  color:#172033;
  font-size:clamp(1.5rem,3vw,2.2rem);
}

.doc-note{
  margin:14px 0 0;
  color:#40576a;
  line-height:1.55;
}

.document-view-shell .source-excerpt-panel{
  max-width:none;
  margin:18px 0;
  border:1px solid #f5c84c;
  border-radius:18px;
  background:#fffdf0;
  box-shadow:0 14px 34px rgba(120,53,15,.10);
}

.document-view-shell .source-excerpt-kicker{
  color:#40576a;
}

.document-view-shell .source-excerpt-label{
  border:0;
  background:#ffe8c2;
  color:#9a3d0a;
}

.document-view-shell .source-highlight{
  border:1px solid #f6d541;
  background:#fff184;
  color:#111827;
  font-size:1rem;
  line-height:1.65;
}

.document-view-shell .pdf-container{
  height:calc(100vh - 260px);
  min-height:560px;
  border:1px solid #d8e4e3;
  border-radius:18px;
  overflow:hidden;
}

@media (max-width:900px){
  .topbar{
    position:relative !important;
    top:auto !important;
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:18px !important;
    padding:18px !important;
    border-radius:22px !important;
  }
  .orgmark{
    width:100%;
    align-items:center;
  }
  .orglogo{
    width:92px !important;
    height:62px !important;
  }
  .topbar-right{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:12px !important;
    justify-content:stretch !important;
    width:100%;
  }
  .toplink{
    justify-content:flex-start !important;
    width:100%;
    min-height:56px;
    padding:14px 18px !important;
    border-radius:16px !important;
    background:rgba(255,255,255,.08) !important;
    box-shadow:none !important;
  }
  .toplink.active,
  .toplink-cta{
    background:rgba(255,255,255,.14) !important;
    border-color:rgba(255,255,255,.26) !important;
  }
  .toplink.active::after{
    display:none;
  }
}

@media (max-width:560px){
  .topbar{
    margin-bottom:14px !important;
  }
  .orgmark{
    gap:12px;
  }
  .orglogo{
    width:72px !important;
    height:54px !important;
  }
  .orgname{
    font-size:14px !important;
  }
  .orgsub{
    font-size:12px !important;
  }
  .hero{
    padding:18px !important;
  }
  .hero-mark{
    align-items:flex-start;
    flex-wrap:wrap;
  }
  .tool-mode-card{
    padding:18px;
  }
  .sidetextarea{
    min-height:160px;
  }
  .document-view-shell{
    padding:10px !important;
  }
  .doc-actions{
    display:grid;
    grid-template-columns:1fr;
  }
  .document-view-shell .pdf-container{
    height:70vh;
    min-height:420px;
  }
}

/* Final mode panel and answer export polish */
.tool-mode-card{
  grid-template-columns:minmax(220px,.28fr) minmax(0,1fr) !important;
  align-items:start !important;
  gap:22px !important;
  padding:22px !important;
  overflow:visible !important;
  background:
    linear-gradient(135deg,rgba(255,255,255,.96),rgba(240,250,246,.94)),
    radial-gradient(circle at top right,rgba(247,180,43,.16),transparent 34%) !important;
  border:1px solid #c7dfda !important;
  box-shadow:0 22px 50px rgba(15,23,42,.08) !important;
}

.tool-mode-copy{
  align-content:start;
  padding-top:4px;
}

.tool-mode-copy span{
  color:#126c3a !important;
  letter-spacing:.14em !important;
}

.tool-mode-copy strong{
  max-width:260px;
  font-size:20px !important;
  line-height:1.22 !important;
}

.tool-mode-copy small{
  display:block;
  max-width:260px;
  margin-top:8px;
  color:#607089;
  font-size:13px;
  line-height:1.45;
}

.mode-choice-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.mode-choice{
  appearance:none;
  display:grid;
  grid-template-columns:44px minmax(0,1fr);
  gap:12px;
  align-items:start;
  min-height:116px;
  padding:16px;
  border:1px solid #d7e4e2;
  border-radius:18px;
  background:#fff;
  color:#172033;
  text-align:left;
  cursor:pointer;
  box-shadow:0 10px 24px rgba(15,23,42,.05);
  transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease,background .18s ease;
}

.mode-choice:hover{
  transform:translateY(-1px);
  border-color:#8fc8bb;
  box-shadow:0 16px 34px rgba(15,23,42,.08);
}

.mode-choice.active{
  border-color:#0f7a45;
  background:linear-gradient(135deg,#effbf5,#ffffff 70%);
  box-shadow:0 16px 36px rgba(18,108,58,.16);
}

.mode-choice.active::after{
  content:"Selected";
  grid-column:2;
  justify-self:start;
  align-self:end;
  margin-top:4px;
  padding:4px 9px;
  border-radius:999px;
  color:#0f6b38;
  background:#dff4e9;
  font-size:10px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.mode-choice-icon{
  display:inline-flex;
  width:44px;
  height:44px;
  align-items:center;
  justify-content:center;
  border-radius:14px;
  color:#fff;
  background:#0f6b38;
  font-weight:900;
  font-size:20px;
  box-shadow:inset 0 -2px 0 rgba(0,0,0,.16);
}

.mode-choice:nth-child(2) .mode-choice-icon{
  background:#d88a00;
}

.mode-choice strong{
  display:block;
  margin:0 0 6px;
  color:#111827;
  font-size:15px;
  line-height:1.25;
}

.mode-choice small{
  display:block;
  color:#5f6f86;
  font-size:12px;
  line-height:1.42;
}

.tool-mode-controls .sideselect{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0 0 0 0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

.tool-mode-hint{
  margin-top:4px !important;
}

.answer-share-menu{
  max-height:min(430px,calc(100vh - 150px));
  overflow:auto;
}

.answer-share-option:disabled{
  cursor:wait;
  opacity:.74;
}

.export-notice{
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:100000;
  max-width:360px;
  padding:14px 16px;
  border:1px solid #f6caca;
  border-left:5px solid #bd2a21;
  border-radius:14px;
  background:#fff7f6;
  color:#7f1d1d;
  font-size:14px;
  font-weight:800;
  box-shadow:0 18px 40px rgba(15,23,42,.18);
  transform:translateY(18px);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease,transform .18s ease;
}

.export-notice.show{
  opacity:1;
  transform:translateY(0);
}

@media (max-width:980px){
  .tool-mode-card{
    grid-template-columns:1fr !important;
  }
  .tool-mode-copy strong,
  .tool-mode-copy small{
    max-width:none;
  }
}

@media (max-width:720px){
  .mode-choice-grid{
    grid-template-columns:1fr;
  }
  .mode-choice{
    min-height:auto;
  }
  .export-notice{
    right:12px;
    bottom:12px;
    left:12px;
    max-width:none;
  }
}

/* Field-level voice recording */
.voice-mode-note{
  padding:12px 14px;
  border:1px solid #d8e9e5;
  border-radius:14px;
  color:#465d72;
  background:#f7fcfa;
  font-size:13px;
  line-height:1.45;
}

.voice-input-wrap{
  position:relative;
  display:flex;
  align-items:center;
  width:100%;
}

.composer-input-wrap{
  flex:1 1 360px;
  min-width:240px;
}

.composer-input-wrap #prompt{
  width:100%;
  padding-right:118px;
}

.voice-textarea-wrap{
  align-items:stretch;
}

.voice-textarea-wrap .sidetextarea{
  width:100%;
  padding-right:126px;
}

.voice-field-btn{
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  z-index:3;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-width:92px;
  min-height:38px;
  padding:8px 12px;
  border:1px solid #b9d8d2;
  border-radius:999px;
  color:#075968;
  background:#eefaf7;
  font-size:12px;
  font-weight:900;
  cursor:pointer;
  box-shadow:0 8px 18px rgba(15,23,42,.08);
  transition:background .18s ease,border-color .18s ease,color .18s ease,transform .18s ease;
}

.voice-field-btn:hover{
  border-color:#0f7a45;
  background:#e1f7ec;
}

.voice-field-btn.recording{
  color:#fff;
  border-color:#bd2a21;
  background:#bd2a21;
}

.voice-field-btn.transcribing{
  color:#fff;
  border-color:#0f6b38;
  background:#0f6b38;
  cursor:wait;
}

.voice-field-btn:disabled{
  opacity:.72;
}

.voice-field-icon{
  position:relative;
  display:inline-flex;
  width:28px;
  height:28px;
  flex:0 0 28px;
  border:1px solid rgba(7,89,104,.16);
  border-radius:999px;
  background:
    #fff url("/static/record.png") center / 15px 15px no-repeat;
  box-shadow:inset 0 -1px 0 rgba(15,23,42,.08);
}

.voice-field-icon::before{
  content:none;
}

.voice-field-icon::after{
  content:none;
}

.voice-field-btn.recording .voice-field-icon{
  border-color:rgba(255,255,255,.28);
  background:
    rgba(255,255,255,.16) url("/static/record.png") center / 15px 15px no-repeat;
  filter:invert(1);
  animation:voicePulse 1.05s ease-in-out infinite;
}

.voice-field-btn.recording .voice-field-icon::before,
.voice-field-btn.recording .voice-field-icon::after{
  display:none;
}

.voice-field-btn.transcribing .voice-field-icon{
  border-color:rgba(255,255,255,.28);
  background:
    rgba(255,255,255,.16) url("/static/record.png") center / 15px 15px no-repeat;
  filter:invert(1);
}

@keyframes voicePulse{
  0%,100%{ box-shadow:0 0 0 0 rgba(255,255,255,.36); }
  50%{ box-shadow:0 0 0 7px rgba(255,255,255,0); }
}

.voice-status{
  flex-basis:100%;
  min-height:18px;
  padding-left:4px;
  color:#0f6b38;
  font-weight:800;
}

@media (max-width:720px){
  .composer-input-wrap{
    flex-basis:100%;
  }
  .composer-input-wrap #prompt,
  .voice-textarea-wrap .sidetextarea{
    padding-right:92px;
  }
  .voice-field-btn{
    min-width:72px;
    min-height:34px;
    padding:7px 9px;
  }
  .voice-field-label{
    display:none;
  }
}
