: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;
}

.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);
}

.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}

#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)}
#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; }

.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;}

/* Responsive layout */
@media (max-width: 600px) {
  .app {max-width: 100%; padding: 0 10px;}
  #chat {height: 50vh;}
  .msg {max-width: 90%; font-size: 14px;}
  .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);
}


/* =========================
   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;
}