/* ===========================================================
   Lab2Life — Design tokens
   Palette: professional grey / forest-green, calm & credible
=========================================================== */
:root{
  --green-900:#1F3D2E;
  --green-700:#2F6B4F;
  --green-600:#3C8060;
  --green-500:#4C8C6B;
  --green-100:#E4EEE7;
  --green-50:#F2F7F4;

  --grey-900:#1D2521;
  --grey-700:#3F4A44;
  --grey-500:#6B7570;
  --grey-300:#B8C0BB;
  --grey-100:#E8ECE9;
  --grey-50:#F6F8F7;

  --white:#FFFFFF;
  --danger:#B3413A;
  --warn:#B4841F;

  --radius-sm:8px;
  --radius-md:14px;
  --radius-lg:20px;
  --shadow-sm:0 1px 2px rgba(29,37,33,.06), 0 1px 1px rgba(29,37,33,.04);
  --shadow-md:0 8px 24px rgba(29,37,33,.08);
  --nav-h:64px;
  --topbar-h:56px;

  --font-display: 'Poppins', 'Segoe UI', Arial, sans-serif;
  --font-body: 'Inter', 'Segoe UI', Arial, sans-serif;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:var(--font-body);
  background:var(--grey-50);
  color:var(--grey-900);
  -webkit-font-smoothing:antialiased;
  padding-bottom:calc(var(--nav-h) + 12px);
  min-height:100vh;
}
h1,h2,h3,h4{font-family:var(--font-display); margin:0 0 8px; color:var(--grey-900); font-weight:600;}
p{margin:0 0 12px; line-height:1.55; color:var(--grey-700);}
a{color:var(--green-700); text-decoration:none;}
.icon{width:20px; height:20px; display:inline-block; vertical-align:-4px;}

/* ===== Layout shell ===== */
.app-shell{max-width:520px; margin:0 auto; min-height:100vh; background:var(--grey-50); position:relative;}
@media (min-width:900px){
  .app-shell{max-width:1080px;}
  body{padding-bottom:24px;}
  .bottom-nav{display:none;}
  .desktop-shell{display:flex; align-items:flex-start;}
  .side-nav{display:flex;}
}

/* ===== Top bar ===== */
.topbar{
  position:sticky; top:0; z-index:20;
  height:var(--topbar-h);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 16px;
  background:rgba(246,248,247,.92);
  backdrop-filter:blur(8px);
  border-bottom:1px solid var(--grey-100);
}
.topbar .brand{display:flex; align-items:center; gap:8px;}
.topbar .brand img{height:26px;}
.topbar-actions{display:flex; align-items:center; gap:10px;}
.avatar-sm{width:32px; height:32px; border-radius:50%; background:var(--green-600); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:600; font-size:13px; overflow:hidden;}
.avatar-sm img{width:100%; height:100%; object-fit:cover;}

/* ===== Bottom nav (mobile app style) ===== */
.bottom-nav{
  position:fixed; left:0; right:0; bottom:0; z-index:30;
  max-width:520px; margin:0 auto;
  display:flex; justify-content:space-around; align-items:center;
  height:var(--nav-h);
  background:var(--white);
  border-top:1px solid var(--grey-100);
  box-shadow:0 -4px 16px rgba(29,37,33,.05);
  padding-bottom:env(safe-area-inset-bottom);
}
.bottom-nav a{
  display:flex; flex-direction:column; align-items:center; gap:3px;
  color:var(--grey-500); font-size:11px; font-weight:500;
  flex:1; padding:6px 2px;
}
.bottom-nav a.active{color:var(--green-700);}
.bottom-nav a .icon{width:22px; height:22px;}

/* ===== Side nav (desktop) ===== */
.side-nav{
  display:none; flex-direction:column; gap:2px;
  width:220px; flex-shrink:0; padding:20px 12px; position:sticky; top:var(--topbar-h);
  height:calc(100vh - var(--topbar-h));
  border-right:1px solid var(--grey-100);
}
.side-nav a{display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:var(--radius-sm); color:var(--grey-700); font-weight:500; font-size:14px;}
.side-nav a.active{background:var(--green-100); color:var(--green-700);}
.main-col{flex:1; min-width:0;}

/* ===== Containers ===== */
.container{padding:16px;}
.section{margin-bottom:22px;}
.section-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:10px;}
.section-head h2{font-size:16px;}
.eyebrow{text-transform:uppercase; letter-spacing:.08em; font-size:11px; font-weight:600; color:var(--green-600);}

/* ===== Cards ===== */
.card{
  background:var(--white); border:1px solid var(--grey-100);
  border-radius:var(--radius-md); padding:16px; box-shadow:var(--shadow-sm);
  margin-bottom:12px;
}
.card-title{font-weight:600; font-size:15px; color:var(--grey-900); margin-bottom:4px;}
.card-meta{font-size:12px; color:var(--grey-500); display:flex; gap:6px; align-items:center; flex-wrap:wrap;}
.tag{
  display:inline-flex; align-items:center; font-size:11px; font-weight:600;
  background:var(--green-100); color:var(--green-700); padding:3px 9px; border-radius:100px;
}
.tag.grey{background:var(--grey-100); color:var(--grey-700);}

/* ===== Buttons ===== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:none; border-radius:var(--radius-sm); padding:12px 18px;
  font-family:var(--font-body); font-weight:600; font-size:14px; cursor:pointer;
  transition:transform .05s ease, background .15s ease;
}
.btn:active{transform:scale(.98);}
.btn-primary{background:var(--green-700); color:#fff;}
.btn-primary:hover{background:var(--green-600);}
.btn-outline{background:transparent; color:var(--green-700); border:1.5px solid var(--green-600);}
.btn-ghost{background:var(--grey-100); color:var(--grey-700);}
.btn-danger{background:var(--danger); color:#fff;}
.btn-block{width:100%;}
.btn-sm{padding:8px 12px; font-size:13px;}

/* ===== Forms ===== */
.field{margin-bottom:14px;}
.field label{display:block; font-size:13px; font-weight:600; color:var(--grey-700); margin-bottom:6px;}
.field input, .field select, .field textarea{
  width:100%; padding:12px 14px; border:1.5px solid var(--grey-100); background:var(--white);
  border-radius:var(--radius-sm); font-family:var(--font-body); font-size:14px; color:var(--grey-900);
}
.field input:focus, .field select:focus, .field textarea:focus{
  outline:none; border-color:var(--green-500); box-shadow:0 0 0 3px var(--green-100);
}
.field textarea{resize:vertical; min-height:90px;}
.input-icon{position:relative;}
.input-icon .icon{position:absolute; left:13px; top:50%; transform:translateY(-50%); color:var(--grey-500);}
.input-icon input{padding-left:40px;}

/* ===== Auth screens ===== */
.auth-wrap{min-height:100vh; display:flex; flex-direction:column; justify-content:center; padding:28px 20px;}
.auth-card{max-width:400px; margin:0 auto; width:100%;}
.auth-logo{display:flex; justify-content:center; margin-bottom:22px;}
.auth-card h1{font-size:21px; text-align:center;}
.auth-sub{text-align:center; margin-bottom:22px;}
.auth-switch{text-align:center; margin-top:14px; font-size:14px; color:var(--grey-700);}

/* ===== Hero (landing) ===== */
.hero{
  background:linear-gradient(160deg, var(--green-900), var(--green-700));
  color:#fff; border-radius:0 0 28px 28px; padding:34px 20px 40px;
}
.hero .eyebrow{color:var(--green-100);}
.hero h1{color:#fff; font-size:26px; line-height:1.25; margin-bottom:10px;}
.hero p{color:var(--green-100); font-size:15px;}
.hero-actions{display:flex; gap:10px; margin-top:18px; flex-wrap:wrap;}
.hero .btn-outline{border-color:rgba(255,255,255,.5); color:#fff;}
.pillar-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:-24px; padding:0 16px 4px;}
.pillar{background:#fff; border-radius:var(--radius-md); padding:14px; box-shadow:var(--shadow-md); text-align:left;}
.pillar .icon{color:var(--green-700); width:24px; height:24px; margin-bottom:8px;}
.pillar h4{font-size:13.5px; margin-bottom:3px;}
.pillar p{font-size:12px; margin:0; color:var(--grey-500);}

/* ===== Chat / research room ===== */
.chat-wrap{display:flex; flex-direction:column; height:calc(100vh - var(--topbar-h) - var(--nav-h) - 64px); background:var(--white); border:1px solid var(--grey-100); border-radius:var(--radius-md); overflow:hidden;}
.chat-messages{flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:10px;}
.msg{max-width:78%; padding:9px 13px; border-radius:14px; font-size:14px; line-height:1.4;}
.msg.mine{align-self:flex-end; background:var(--green-700); color:#fff; border-bottom-right-radius:4px;}
.msg.theirs{align-self:flex-start; background:var(--grey-100); color:var(--grey-900); border-bottom-left-radius:4px;}
.msg .msg-author{font-size:11px; font-weight:600; margin-bottom:3px; opacity:.75;}
.msg .msg-time{font-size:10px; opacity:.6; margin-top:3px; display:block;}
.chat-input{display:flex; gap:8px; padding:10px; border-top:1px solid var(--grey-100);}
.chat-input input{flex:1; border:1.5px solid var(--grey-100); border-radius:100px; padding:10px 16px; font-size:14px;}
.chat-input button{width:42px; height:42px; border-radius:50%; background:var(--green-700); color:#fff; border:none; display:flex; align-items:center; justify-content:center; flex-shrink:0;}

/* ===== AI ideation panel ===== */
.ai-panel{background:linear-gradient(160deg, var(--green-50), var(--white)); border:1px solid var(--green-100); border-radius:var(--radius-md); padding:16px;}
.ai-response{background:var(--white); border:1px solid var(--grey-100); border-radius:var(--radius-md); padding:16px; margin-top:14px; white-space:pre-wrap; font-size:14px; line-height:1.6;}
.ai-loading{display:flex; align-items:center; gap:10px; color:var(--grey-500); font-size:13px; padding:14px 0;}
.dot-pulse{width:8px; height:8px; border-radius:50%; background:var(--green-600); animation:pulse 1s infinite ease-in-out;}
@keyframes pulse{0%,100%{opacity:.3} 50%{opacity:1}}

/* ===== Alerts / flash ===== */
.alert{padding:12px 14px; border-radius:var(--radius-sm); font-size:13.5px; margin-bottom:14px; display:flex; gap:10px; align-items:flex-start;}
.alert-success{background:var(--green-100); color:var(--green-900);}
.alert-error{background:#F8E7E5; color:var(--danger);}
.alert .icon{flex-shrink:0; margin-top:1px;}

/* ===== Empty states ===== */
.empty{text-align:center; padding:40px 20px; color:var(--grey-500);}
.empty .icon{width:36px; height:36px; color:var(--grey-300); margin-bottom:10px;}

/* ===== Badges / status pill ===== */
.pill{font-size:11px; font-weight:600; padding:3px 10px; border-radius:100px;}
.pill-open{background:var(--green-100); color:var(--green-700);}
.pill-closed{background:var(--grey-100); color:var(--grey-500);}
.pill-pending{background:#FBF2E1; color:var(--warn);}
.pill-approved{background:var(--green-100); color:var(--green-700);}
.pill-rejected{background:#F8E7E5; color:var(--danger);}

/* ===== Search bar ===== */
.search-bar{display:flex; align-items:center; gap:8px; background:var(--white); border:1.5px solid var(--grey-100); border-radius:100px; padding:10px 16px; margin-bottom:14px;}
.search-bar .icon{color:var(--grey-500); flex-shrink:0;}
.search-bar input{border:none; outline:none; flex:1; font-size:14px; background:transparent;}

/* ===== Chips / filters ===== */
.chip-row{display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; margin-bottom:14px;}
.chip{flex-shrink:0; padding:7px 14px; border-radius:100px; background:var(--white); border:1.5px solid var(--grey-100); font-size:12.5px; font-weight:600; color:var(--grey-700); white-space:nowrap;}
.chip.active{background:var(--green-700); color:#fff; border-color:var(--green-700);}

/* ===== Tables (admin) ===== */
table.data-table{width:100%; border-collapse:collapse; font-size:13.5px; background:#fff;}
table.data-table th{text-align:left; padding:10px 12px; background:var(--grey-50); color:var(--grey-500); font-size:11px; text-transform:uppercase; letter-spacing:.04em;}
table.data-table td{padding:10px 12px; border-top:1px solid var(--grey-100); color:var(--grey-900);}
.table-scroll{overflow-x:auto; border:1px solid var(--grey-100); border-radius:var(--radius-md);}

/* ===== Stat cards ===== */
.stat-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px;}
@media (min-width:700px){.stat-grid{grid-template-columns:repeat(4,1fr);}}
.stat-card{background:#fff; border:1px solid var(--grey-100); border-radius:var(--radius-md); padding:14px;}
.stat-card .stat-num{font-family:var(--font-display); font-size:24px; font-weight:700; color:var(--green-700);}
.stat-card .stat-label{font-size:12px; color:var(--grey-500);}

.text-center{text-align:center;}
.mt-0{margin-top:0;}
.small{font-size:12px; color:var(--grey-500);}
