:root {
  /* ── Bough Bio brand palette ─────────────────────────────────────────── */
  --brand-navy:    #242258;   /* topbar, headings */
  --brand-navy-hi: #1e3040;   /* hover states over navy surfaces */
  --brand-green:   #1f4745;   /* accent, primary CTA */
  --brand-green-hi:#40916C;   /* accent hover */
  --brand-cream:   #F2F8F4;   /* soft green tint */
  --brand-gold:    #c0952d;   /* warn / template star */

  /* Semantic tokens (existing components reference these) */
  --bg:        #F5F6F8;
  --card:      #FFFFFF;
  --ink:       #1F2630;
  --muted:     #6A7280;
  --line:      #E5E7EB;
  --accent:    var(--brand-green);
  --accent-hi: var(--brand-green-hi);
  --danger:    #B94B4B;
  --warn:      var(--brand-gold);
  --chip-bg:   var(--brand-cream);
  --shadow: 0 1px 2px rgba(20,33,43,.04), 0 4px 12px rgba(20,33,43,.05);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; background: var(--brand-navy); color: #fff;
  box-shadow: 0 2px 8px rgba(20,33,43,.18);
  position: sticky; top: 0; z-index: 100;
}
.topbar .brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-divider {
  width: 1px; height: 24px; background: rgba(255,255,255,.28); display: inline-block;
}
.brand-app {
  font-size: 13px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255,255,255,.85);
}
.topbar nav { display: flex; align-items: center; gap: 20px; }
.topbar nav a {
  color: rgba(255,255,255,.75); font-size: 13.5px; font-weight: 500;
  padding: 6px 2px; border-bottom: 2px solid transparent; transition: color .12s ease, border-color .12s ease;
}
.topbar nav a:hover { color: #fff; text-decoration: none; border-color: rgba(255,255,255,.4); }
.user-chip {
  color: rgba(255,255,255,.72); font-size: 12px; padding-left: 16px;
  border-left: 1px solid rgba(255,255,255,.22); margin-left: 4px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block; padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff !important;
  font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-hi); border-color: var(--accent-hi); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--accent) !important; }
.btn.secondary:hover { background: #f2f8f4; }
.btn.ghost { background: transparent; color: var(--ink) !important; border-color: var(--line); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { background: var(--danger); border-color: var(--danger); }

/* ---- Layout ---- */
main { max-width: 1400px; margin: 24px auto; padding: 0 24px 80px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
h1 { font-size: 24px; margin: 0 0 4px; color: var(--brand-navy); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 12px; margin: 20px 0 10px; color: var(--muted);
     text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end;
  margin: 8px 0 18px; }
.subtle { color: var(--muted); font-size: 12px; }

/* ---- Study list ---- */
.search-wrap { margin-bottom: 12px; }
.search-wrap input {
  width: 100%; padding: 10px 14px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.search-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(45,106,79,.15); }

.filter-chips { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.filter-label { font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .4px; font-weight: 600; margin-right: 2px; }
.chip {
  padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  font-size: 12px; cursor: pointer; color: var(--ink);
}
.chip.active { background: var(--chip-bg); border-color: var(--accent); color: var(--accent); }
.col-toggles { margin-bottom: 16px; }
.col-toggle {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px;
  border-radius: 999px; background: #fff; border: 1px solid var(--line);
  font-size: 12px; cursor: pointer; color: var(--ink); user-select: none;
}
.col-toggle input[type="checkbox"] { cursor: pointer; }
.chip:hover { border-color: var(--accent); }

.study-table { width: 100%; border-collapse: collapse; }
.study-table th, .study-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
.study-table th { color: var(--muted); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: .4px; background: #fafbfc; }
.study-table tr:hover td { background: #fafbfc; }
.study-table .id { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.status-badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 500;
}
.study-table th.sortable { cursor: pointer; user-select: none; position: relative; }
.study-table th.sortable:hover { color: var(--ink); }
.study-table th.sortable::after { content: '\2195'; margin-left: 5px; opacity: .35; font-size: 11px; }
.study-table th.sortable.sorted-asc::after { content: '\2191'; opacity: 1; color: var(--accent); }
.study-table th.sortable.sorted-desc::after { content: '\2193'; opacity: 1; color: var(--accent); }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px 12px; border-top: 1px solid var(--line);
}
.pager-info { font-size: 12px; color: var(--muted); }
.pager .btn[disabled] { opacity: .4; cursor: not-allowed; }

.drive-link-inline { font-size: 12px; font-weight: 500; white-space: nowrap; }

.study-table th.nowrap,
.study-table td.nowrap { white-space: nowrap; }
.status-Planned  { background: #eef2f7; color: #4a5a6b; }
.status-Active   { background: #e3f5ec; color: #276749; }
.status-Complete { background: #e8eaf6; color: #4a5687; }
.status-Archived { background: #f5eee3; color: #7a6032; }
.template-star { color: #b8860b; margin-right: 4px; }

/* Bioinformatics report status — checked live against Drive, see docs.js */
.status-completed   { background: #e3f5ec; color: #276749; }
.status-in-progress { background: #fef3c7; color: #92400e; }
.status-unknown      { background: #e5e7eb; color: #4b5563; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 13px; background: #fff; color: var(--ink);
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(45,106,79,.15);
}
.field .hint { font-size: 11px; color: var(--muted); margin-top: 3px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

/* ---- Study detail ---- */
.study-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.study-header h1 { display: flex; align-items: center; gap: 12px; }
.study-header .id-tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--chip-bg); color: var(--accent); padding: 2px 10px; border-radius: 6px;
  font-size: 14px; font-weight: 600; }
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; }
.meta-item label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .3px; }
.meta-item .value { font-size: 14px; color: var(--ink); }
.meta-item .value.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.meta-item.full { grid-column: 1 / -1; }
.meta-item .value.multiline { white-space: pre-wrap; }

.drive-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1px solid var(--accent); background: #f2f8f4; border-radius: 6px;
  color: var(--accent) !important; font-size: 13px; font-weight: 500;
}
.drive-link:hover { background: var(--chip-bg); text-decoration: none; }

.audit-list { list-style: none; padding: 0; margin: 0; }
.audit-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.audit-list .action { color: var(--ink); font-weight: 500; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #14212b; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.2); z-index: 9999;
  animation: toast-in .15s ease-out;
}
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- Login ---- */
.login-card { max-width: 420px; margin: 60px auto; text-align: center; padding: 40px 30px; }
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.google-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink) !important; font-weight: 500; text-decoration: none;
}
.google-btn:hover { background: #fafbfc; text-decoration: none; }

/* ---- Empty state ---- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty p { margin: 0 0 12px; }

/* ---- Inventory cell-line summary strip ---- */
.cell-line-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px; margin-bottom: 20px; }
.cell-line-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow);
}
.cell-line-card:hover { border-color: var(--accent); text-decoration: none; }
.cell-line-card .cl-name { font-size: 16px; font-weight: 600; color: var(--ink); }
.cell-line-card .cl-full { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cell-line-card .cl-badges { display: flex; gap: 6px; margin-top: 10px; }
.cell-line-card .cl-counts { margin-top: 12px; font-size: 12px; display: flex; gap: 10px; color: var(--muted); }
.cell-line-card .count-in-stock { color: var(--accent); font-weight: 500; }
.cell-line-card .count-thawed { color: #b8860b; font-weight: 500; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px;
  font-weight: 600; letter-spacing: .3px; }
.badge.rg-RG1 { background: #e3f5ec; color: #276749; }
.badge.rg-RG2 { background: #fef3c7; color: #92400e; }
.badge.rg-RG3 { background: #fee2e2; color: #991b1b; }
.badge.bsl-1  { background: #e3f5ec; color: #276749; }
.badge.bsl-2  { background: #fef3c7; color: #92400e; }
.badge.bsl-3  { background: #fee2e2; color: #991b1b; }

/* Thaw history rows */
.thaw-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.thaw-row:last-child { border-bottom: none; }
.thaw-date { font-weight: 600; font-size: 13px; color: var(--ink); }
.thaw-reason { color: var(--muted); font-size: 13px; margin: 4px 0; }
.thaw-studies { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; }
.thaw-studies-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; margin-right: 4px; }
.study-chip { display: inline-block; padding: 3px 10px; background: var(--chip-bg); color: var(--accent) !important;
  border-radius: 999px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 500; text-decoration: none; }
.study-chip:hover { background: #d5e6dc; text-decoration: none; }

/* Extra vial-status badge variants */
.status-badge.status-In\ stock { background: #e3f5ec; color: #276749; }
.status-badge.status-Thawed { background: #fef3c7; color: #92400e; }
.status-badge.status-Discarded { background: #e5e7eb; color: #4b5563; }
.status-badge.status-Lost { background: #fee2e2; color: #991b1b; }

