/* ═══════════════════════════════════════════════════════════════════════════
   GeroBrowser — teal / emerald design system (dark sidebar + light content)
   inspired by the reference console. class names preserved.
   ═══════════════════════════════════════════════════════════════════════════ */
@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("/static/fonts/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  /* content surfaces */
  --bg: #eef2f3;
  --bg-2: #e7edee;
  --surface: #ffffff;
  --surface-2: #f4f8f8;

  /* ink */
  --ink: #15242a;
  --ink-soft: #566a71;
  --muted: #93a3a8;

  /* borders */
  --border: #d8e2e3;
  --border-soft: #e7eeef;

  /* teal / emerald accents */
  --teal: #14b8a6;
  --teal-bright: #2dd4bf;
  --teal-deep: #0d9488;
  --teal-dark: #0f766e;
  --primary: #14b8a6;
  --primary-ink: #0c8579;
  --primary-strong: #0d9488;
  --grad: linear-gradient(135deg, #17c3ac 0%, #0d9488 100%);
  --grad-bright: linear-gradient(135deg, #2dd4bf 0%, #14b8a6 100%);
  --grad-soft: linear-gradient(135deg, #e3f7f3 0%, #e0f5ef 100%);

  /* dark sidebar (deep teal) */
  --side-bg: #102a2c;
  --side-bg-2: #0c2123;
  --side-ink: #a6bdbc;
  --side-ink-dim: #6e8788;
  --side-active: linear-gradient(135deg, #17c3ac, #0e9384);
  --side-hover: rgba(255, 255, 255, .06);
  --side-brd: rgba(255, 255, 255, .07);

  /* dark hero */
  --hero-bg: linear-gradient(120deg, #0a2426 0%, #0f3a3b 48%, #0c2f33 100%);

  /* semantic */
  --ok: #f5b301;
  --ok-bg: #fdf1cf;
  --green: #22c55e;
  --green-bg: #d9f6e4;
  --red: #ef4757;
  --red-bg: #fde4e6;
  --amber: #f5b301;

  /* shadows */
  --shadow-sm: 0 1px 2px rgba(15, 40, 42, .05), 0 2px 8px rgba(15, 40, 42, .05);
  --shadow: 0 2px 6px rgba(15, 40, 42, .06), 0 12px 28px rgba(15, 40, 42, .09);
  --shadow-pop: 0 10px 30px rgba(15, 40, 42, .16), 0 30px 70px rgba(15, 40, 42, .18);
  --glow: 0 6px 20px rgba(20, 184, 166, .34);
  --glow-strong: 0 8px 28px rgba(20, 184, 166, .48);

  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 22px;
  --sidebar-w: 250px;
  --sidebar-collapsed: 76px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(900px 520px at 8% -6%, #dcefec 0%, transparent 55%),
    radial-gradient(820px 480px at 104% 6%, #dff2ef 0%, transparent 52%);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
h1, h2, h3, h4 { font-weight: 750; line-height: 1.28; color: var(--ink); margin: 0; letter-spacing: -0.02em; word-break: keep-all; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.04rem; }
a { color: var(--primary-ink); text-decoration: none; transition: color .18s; }
a:hover { color: var(--teal-deep); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
::selection { background: rgba(20, 184, 166, .22); }

* { scrollbar-width: thin; scrollbar-color: #bcccce transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #c3d2d3; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #a6bcbd; background-clip: content-box; }

.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }

/* ── App shell ──────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  border-right: 1px solid var(--side-brd);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: width .3s var(--ease), flex-basis .3s var(--ease);
  z-index: 40;
}
.app.collapsed .sidebar { width: var(--sidebar-collapsed); flex-basis: var(--sidebar-collapsed); }
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 18px; cursor: pointer; min-height: 66px; user-select: none;
  border-bottom: 1px solid var(--side-brd);
}
.brand .logo { width: 54px; height: 54px; flex: 0 0 54px; filter: drop-shadow(0 4px 14px rgba(20, 184, 166, .5)); transition: transform .7s var(--ease); }
.brand:hover .logo, .brand:focus .logo { transform: rotate(360deg) scale(1.08); }
.brand .brand-name { font-weight: 830; font-size: 1.28rem; letter-spacing: -0.03em; white-space: nowrap; color: #eafcf8; line-height: 1.1; }
.brand .brand-sub { font-size: .68rem; color: var(--side-ink-dim); font-weight: 600; letter-spacing: .02em; margin-top: 1px; }
.brand .brand-txt { min-width: 0; }
.app.collapsed .brand-name, .app.collapsed .brand-sub { opacity: 0; width: 0; overflow: hidden; }
.app.collapsed .brand { justify-content: center; padding-left: 8px; padding-right: 8px; gap: 0; }
.app.collapsed .brand-txt { width: 0; overflow: hidden; }

.nav { flex: 1; padding: 12px 12px; overflow-y: auto; overflow-x: hidden; }
.nav-section { font-size: .66rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--side-ink-dim); padding: 6px 13px; margin: 12px 0 3px; white-space: nowrap; }
.app.collapsed .nav-section { opacity: 0; height: 6px; margin: 6px 0; padding: 0; overflow: hidden; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 13px;
  padding: 11px 13px; margin: 2px 0; border-radius: var(--radius-sm);
  color: var(--side-ink); font-weight: 620; white-space: nowrap; cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.nav a .ic { flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center; transition: transform .25s var(--ease); }
.nav a:hover { background: var(--side-hover); color: #eafcf8; transform: translateX(2px); }
.nav a:hover .ic { transform: scale(1.12); color: var(--teal-bright); }
.nav a.active { color: #ffffff; background: var(--side-active); box-shadow: var(--glow); }
.nav a.active .ic { color: #fff; }
.nav .nav-label { transition: opacity .2s; }
.app.collapsed .nav .nav-label { opacity: 0; width: 0; overflow: hidden; }
.app.collapsed .nav a { justify-content: center; }
.nav .nav-sep { height: 1px; background: var(--side-brd); margin: 10px 8px; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--side-brd); display: flex; flex-direction: column; gap: 8px; }
.side-lang-label { font-size: .66rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--side-ink-dim); padding: 0 4px; }
.app.collapsed .side-lang-label { display: none; }
.side-lang { display: flex; background: rgba(255, 255, 255, .05); border: 1px solid var(--side-brd); border-radius: 10px; padding: 3px; gap: 3px; }
.side-lang button { flex: 1; border: none; background: transparent; padding: 7px 0; border-radius: 7px; cursor: pointer; font-weight: 680; color: var(--side-ink-dim); transition: all .2s var(--ease); font-size: .82rem; }
.side-lang button:hover { color: #eafcf8; }
.side-lang button.on { background: var(--side-active); color: #fff; box-shadow: 0 3px 10px rgba(20, 184, 166, .3); }
.app.collapsed .side-lang { flex-direction: column; }
.nav-logout { display: flex; align-items: center; gap: 12px; padding: 10px 13px; border-radius: var(--radius-sm); color: var(--side-ink) !important; font-weight: 620; transition: background .2s, color .2s; white-space: nowrap; }
.nav-logout:hover { background: rgba(239, 71, 87, .16); color: #ffb3ba !important; text-decoration: none; }
.nav-logout .ic { flex: 0 0 22px; display: grid; place-items: center; }
.app.collapsed .nav-logout { justify-content: center; }
.app.collapsed .nav-logout .nav-label { opacity: 0; width: 0; overflow: hidden; }
.app.collapsed .sidebar-foot { padding: 10px 8px; align-items: center; }
.app.collapsed .side-lang { flex-direction: column; width: 100%; }
.app.collapsed .side-lang button { padding: 6px 0; font-size: .74rem; }
.app.collapsed .collapse-row { justify-content: center; padding: 9px 0; }
.collapse-row { display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: var(--radius-sm); color: var(--side-ink-dim); font-weight: 620; cursor: pointer; font-size: .84rem; transition: background .2s, color .2s; white-space: nowrap; }
.collapse-row:hover { background: var(--side-hover); color: #eafcf8; }
.collapse-row .ic { transition: transform .3s var(--ease); }
.app.collapsed .collapse-row .ic { transform: rotate(180deg); }
.app.collapsed .collapse-row .nav-label { opacity: 0; width: 0; overflow: hidden; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 26px; background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; z-index: 30;
}
.topbar .crumb { font-weight: 700; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.topbar .crumb .home { color: var(--primary-ink); }
.topbar .crumb .sep { color: var(--muted); }
.topbar .spacer { flex: 1; }
.model-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; background: var(--grad-soft); border: 1px solid rgba(20, 184, 166, .22); color: var(--primary-ink); font-weight: 700; font-size: .82rem; }
.model-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.icon-btn { width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); transition: background .2s var(--ease), color .2s, border-color .2s, transform .12s, box-shadow .2s; }
.icon-btn:hover { background: var(--surface-2); color: var(--primary-ink); border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0) scale(.96); }
.hamburger { display: none; }
.content { padding: 26px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font-weight: 660; cursor: pointer;
  transition: transform .14s var(--ease), background .2s, border-color .2s, box-shadow .25s, color .2s;
  text-decoration: none; white-space: nowrap;
}
.btn::after { content: ""; position: absolute; top: 0; left: -80%; width: 60%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent); transform: skewX(-18deg); transition: left .6s var(--ease); pointer-events: none; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--primary); color: var(--primary-ink); }
.btn:hover::after { left: 130%; }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow); }
.btn.primary:hover { color: #fff; box-shadow: var(--glow-strong); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(20, 184, 166, .1); box-shadow: none; }
.btn.danger { color: var(--red); border-color: #f3c9cd; background: #fef4f5; }
.btn.danger:hover { background: var(--red); color: #fff; border-color: transparent; box-shadow: 0 6px 20px rgba(239, 71, 87, .4); }
.btn.dark { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #eafcf8; backdrop-filter: blur(6px); }
.btn.dark:hover { background: rgba(255, 255, 255, .18); color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn.sm { padding: 7px 12px; font-size: .86rem; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none; }
.btn .ic { display: grid; place-items: center; }

/* ── Cards & grids ──────────────────────────────────────────────────────── */
.card { position: relative; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s; }
.card:hover { box-shadow: var(--shadow); }
.card.pad-lg { padding: 26px; }
.grid { display: grid; gap: 18px; min-width: 0; }
/* Grid/flex items default to min-width:auto, which lets wide content (nowrap
   tables, fixed-width bar rows) inflate the track past the viewport and get
   clipped. Allow items to shrink so inner scroll/ellipsis handles overflow. */
.grid > * { min-width: 0; }
.kpi-grid { grid-template-columns: repeat(4, 1fr); }
.cols-2 { grid-template-columns: 1.6fr 1fr; }

.kpi { position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.kpi::before { content: ""; position: absolute; inset: 0; opacity: 0; background: var(--grad-soft); transition: opacity .3s; z-index: 0; }
/* KPI cards can be links/buttons — normalize and signal interactivity */
a.kpi, button.kpi { text-decoration: none; color: inherit; font: inherit; text-align: left; width: 100%; cursor: pointer; }
a.kpi:focus-visible, button.kpi:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.kpi:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.kpi:hover::before { opacity: .6; }
.kpi > * { position: relative; z-index: 1; }
.kpi .gauge { width: 62px; height: 62px; flex: 0 0 62px; border-radius: 50%; display: grid; place-items: center; position: relative; transition: transform .4s var(--ease); }
.kpi:hover .gauge { transform: rotate(6deg) scale(1.05); }
.kpi .gauge::before { content: ""; position: absolute; inset: 6px; background: var(--surface); border-radius: 50%; box-shadow: inset 0 1px 3px rgba(15, 40, 42, .08); }
.kpi .gauge .g-ic { position: relative; z-index: 1; color: var(--primary-ink); }
.kpi .kpi-val { font-size: 2.05rem; font-weight: 850; letter-spacing: -0.035em; line-height: 1.05;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums; transform-origin: left center;
  filter: drop-shadow(0 3px 10px rgba(20, 184, 166, .2)); }
.kpi .kpi-label { color: var(--ink-soft); font-size: .86rem; font-weight: 640; }
@keyframes numPop { 0% { transform: scale(1); } 45% { transform: scale(1.14); } 100% { transform: scale(1); } }
.num-pop { animation: numPop .55s var(--ease); }

/* ── Section titles ─────────────────────────────────────────────────────── */
.section-title { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; }
.section-title h2 { font-size: 1.08rem; }
.section-title h2::before { content: ""; display: inline-block; width: 4px; height: 15px; border-radius: 999px; background: var(--grad); margin-right: 9px; vertical-align: -2px; }
.section-title .spacer { flex: 1; }

/* ── List ───────────────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 9px; }
.list-item { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; text-align: left; transition: transform .22s var(--ease), border-color .22s, box-shadow .22s, background .22s; }
.list-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); transform: scaleY(0); transform-origin: bottom; transition: transform .28s var(--ease); }
.list-item:hover { border-color: transparent; background: var(--surface-2); box-shadow: var(--shadow); transform: translateX(4px); text-decoration: none; }
.list-item:hover::before { transform: scaleY(1); }
.list-item .li-avatar { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px; background: var(--grad-soft); display: grid; place-items: center; color: var(--primary-ink); font-weight: 820; border: 1px solid var(--border-soft); transition: transform .28s var(--ease); }
.list-item:hover .li-avatar { transform: scale(1.08) rotate(-3deg); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 720; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-sub { color: var(--ink-soft); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-meta { color: var(--muted); font-size: .8rem; white-space: nowrap; flex: 0 0 auto; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .77rem; font-weight: 700; white-space: nowrap; background: var(--grad-soft); color: var(--primary-ink); border: 1px solid rgba(20, 184, 166, .2); }
.badge.ok { background: var(--ok-bg); color: #a9800a; border-color: rgba(245, 179, 1, .28); }
.badge.green { background: var(--green-bg); color: #17913f; border-color: rgba(34, 197, 94, .28); }
.badge.red { background: var(--red-bg); color: var(--red); border-color: rgba(239, 71, 87, .28); }
.badge.muted { background: #edf1f1; color: var(--ink-soft); border-color: var(--border-soft); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); animation: pulseDot 1.8s ease-in-out infinite; }
@keyframes pulseDot { 0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, .16); } 50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); } }
.check-circle { width: 20px; height: 20px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; color: #fff; flex: 0 0 20px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; min-width: 560px; }
table.data th, table.data td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
table.data th { font-size: .78rem; color: var(--ink-soft); font-weight: 720; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { cursor: pointer; transition: background .16s; }
table.data tbody tr:hover { background: var(--grad-soft); }
.ellip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { margin-bottom: 15px; }
.field label { display: block; font-weight: 660; font-size: .87rem; margin-bottom: 7px; color: var(--ink-soft); }
.input, .select, textarea.input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); outline: none; transition: border-color .2s, box-shadow .25s, background .2s; }
.input:hover, .select:hover, textarea.input:hover { border-color: #bcccce; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(20, 184, 166, .16); }
textarea.input { resize: vertical; min-height: 92px; line-height: 1.6; }
.hint { color: var(--muted); font-size: .84rem; margin-top: 7px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 4px; gap: 3px; }
.seg button { border: none; background: transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 660; color: var(--ink-soft); transition: all .22s var(--ease); white-space: nowrap; }
#pp-style, #pp-color { width: 100%; }
#pp-style button, #pp-color button { flex: 1; padding: 7px 6px; font-size: .82rem; }
.seg button:hover { color: var(--primary-ink); }
.seg button.on { background: var(--surface); color: var(--primary-ink); box-shadow: var(--shadow-sm); }

/* ── Progress ───────────────────────────────────────────────────────────── */
.progress { height: 9px; border-radius: 999px; background: #dde7e7; overflow: hidden; position: relative; }
.progress > i { display: block; height: 100%; background: var(--grad); border-radius: 999px; transition: width .5s var(--ease); position: relative; box-shadow: var(--glow); }
.progress > i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }
.progress.indeterminate > i { width: 35% !important; animation: indet 1.2s var(--ease) infinite; }
@keyframes indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Toast + pill ───────────────────────────────────────────────────────── */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: rgba(255, 255, 255, .86); backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%); border: 1px solid var(--border-soft); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); padding: 13px 17px; min-width: 250px; max-width: 380px; display: flex; align-items: center; gap: 11px; animation: toastIn .45s var(--ease); }
.toast .ic { color: var(--primary); display: grid; place-items: center; }
.toast.ok { border-left-color: var(--green); } .toast.ok .ic { color: var(--green); }
.toast.err { border-left-color: var(--red); } .toast.err .ic { color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.9); } to { opacity: 1; transform: none; } }

#pill-tray { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 150; display: flex; flex-direction: column; gap: 9px; align-items: center; width: min(92vw, 470px); }
.pill { display: flex; align-items: center; gap: 13px; width: 100%; background: rgba(255, 255, 255, .88); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); border: 1px solid var(--border-soft); border-radius: 999px; box-shadow: var(--shadow-pop); padding: 10px 10px 10px 18px; cursor: pointer; animation: pillIn .5s var(--ease); transition: transform .2s var(--ease); }
.pill:hover { transform: translateY(-3px); }
.pill .pill-spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(20, 184, 166, .2); border-top-color: var(--primary); animation: spin .8s linear infinite; flex: 0 0 22px; }
.pill .pill-main { flex: 1; min-width: 0; }
.pill .pill-title { font-weight: 720; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill .pill-bar { height: 6px; border-radius: 999px; background: #dde7e7; overflow: hidden; margin-top: 5px; }
.pill .pill-bar > i { display: block; height: 100%; background: var(--grad); border-radius: 999px; transition: width .5s var(--ease); }
.pill .pill-pct { font-size: .8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; flex: 0 0 auto; font-weight: 700; }
.pill.done .pill-spin { border: none; background: var(--grad); position: relative; animation: popIn .4s var(--ease); }
.pill.err .pill-spin { border: none; background: var(--red); animation: shake .4s; }
@keyframes pillIn { from { opacity: 0; transform: translateY(20px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes popIn { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 30, 32, .44); backdrop-filter: blur(5px); z-index: 300; display: grid; place-items: center; padding: 16px; animation: fade .25s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); width: min(640px, 96vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; animation: modalIn .4s var(--ease); border: 1px solid var(--border-soft); }
.modal.wide { width: min(880px, 96vw); }
@keyframes modalIn { from { opacity: 0; transform: translateY(26px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border-soft); }
.modal-head h3 { flex: 1; }
.modal-head h3::before { content: ""; display: inline-block; width: 4px; height: 16px; border-radius: 999px; background: var(--grad); margin-right: 10px; vertical-align: -2px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--border-soft); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); }

/* ── Login (split hero + card) ─────────────────────────────────────────── */
.login-split { min-height: 100vh; min-height: 100dvh; display: flex; background: var(--surface); }
.login-hero { flex: 1 1 50%; position: relative; overflow: hidden; display: flex; align-items: center; background: #0a2426; }
.login-hero::before { content: ""; position: absolute; inset: 0; background: url("/static/img/banner.jpg") center center / cover no-repeat; }
.login-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(6,24,25,.9) 0%, rgba(9,40,42,.6) 55%, rgba(11,52,52,.42) 100%); }
.login-hero-inner { position: relative; z-index: 1; padding: 0 9%; max-width: 600px; color: #fff; }
.login-hero-logo { width: 66px; height: 66px; margin-bottom: 22px; filter: drop-shadow(0 8px 26px rgba(20,184,166,.65)); animation: floatLogo 4s ease-in-out infinite; }
.login-hero .eyebrow { color: var(--teal-bright); font-weight: 800; letter-spacing: .18em; font-size: .78rem; margin-bottom: 14px; }
.login-hero h1 { font-size: 2.4rem; line-height: 1.22; color: #fff; letter-spacing: -.02em; }
.login-hero .sources { color: rgba(255,255,255,.72); margin-top: 18px; font-size: .98rem; line-height: 1.7; }
.login-main { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card2 { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border-soft); border-radius: 20px; box-shadow: var(--shadow); padding: 34px 32px; animation: modalIn .5s var(--ease); }
.login-card2 .lc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.login-card2 .lc-brand { font-weight: 850; font-size: 1.3rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.login-card2 .lc-lang button { padding: 5px 11px; font-size: .78rem; }
.login-card2 h2 { font-size: 1.3rem; }
.login-card2 .lc-sub { color: var(--ink-soft); margin: 6px 0 22px; font-size: .92rem; }
.login-card2 .input { padding: 14px 16px; border-radius: 12px; }
.login-card2 .btn.primary { width: 100%; padding: 14px; font-size: 1rem; margin-top: 6px; }
.login-card2 .login-err { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,71,87,.3); border-radius: 12px; padding: 11px 13px; font-size: .88rem; margin-bottom: 15px; font-weight: 600; }
@media (max-width: 860px) {
  html, body.login-split { overflow-x: hidden; max-width: 100%; }
  .login-split { display: block; min-height: 100dvh; }
  .login-hero { display: block; width: 100%; min-height: 190px; padding: 90px 22px 22px; box-sizing: border-box; }
  .login-hero::before, .login-hero::after { position: absolute; }
  .login-hero-inner { display: block; position: relative; width: 100%; max-width: 100%; padding: 0; box-sizing: border-box; }
  .login-hero-logo { width: 44px; height: 44px; margin-bottom: 10px; }
  .login-hero .eyebrow { font-size: .72rem; margin-bottom: 8px; }
  .login-hero h1 { font-size: 1.35rem; }
  .login-hero .sources { font-size: .8rem; margin-top: 9px; }
  .login-main { display: block; width: 100%; max-width: 100%; padding: 20px 18px 44px; box-sizing: border-box; }
  .login-card2 { display: block; width: 100%; max-width: 100%; margin: 0; border: none; box-shadow: none; padding: 18px 0 0; box-sizing: border-box; }
  .login-card2 .input { width: 100%; max-width: 100%; box-sizing: border-box; }
  .login-card2 .lc-head { gap: 10px; }
}

/* ── Error page ─────────────────────────────────────────────────────────── */
.error-page { min-height: 100vh; display: grid; place-items: center; }
.error-box { text-align: center; padding: 40px; }
.error-box .error-code { font-size: 4.5rem; font-weight: 850; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ── Welcome hero banner (dashboard + species) ──────────────────────────── */
.hero { position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 40px 36px; background: var(--hero-bg); color: #fff; box-shadow: var(--shadow); }
.hero::before { content: ""; position: absolute; inset: 0; background: url("/static/img/banner.jpg") center center / cover no-repeat; z-index: 0; transform: scale(1.02); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(95deg, rgba(7,30,32,.95) 0%, rgba(9,34,37,.74) 40%, rgba(10,42,46,.34) 100%); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: 2rem; }
.hero .sci { font-style: italic; font-size: 2.1rem; font-weight: 850; letter-spacing: -0.03em; color: #fff; }
.hero .common { color: rgba(255, 255, 255, .78); font-size: 1.08rem; margin-top: 5px; }
.hero p { color: rgba(255, 255, 255, .82); max-width: 62ch; }
.hero .badge { background: rgba(255, 255, 255, .12); color: #eafcf8; border-color: rgba(255, 255, 255, .2); }
.hero .badge.muted { background: rgba(255, 255, 255, .07); color: rgba(255, 255, 255, .75); }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat-tile { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px 18px; box-shadow: var(--shadow-sm); transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.stat-tile::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease); }
.stat-tile:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.stat-tile:hover::before { transform: scaleX(1); }
.stat-tile .st-val { font-size: 2.3rem; font-weight: 860; letter-spacing: -0.04em; line-height: 1.05;
  background: var(--grad-bright); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums; transform-origin: left center;
  filter: drop-shadow(0 3px 12px rgba(20, 184, 166, .24)); }
.stat-tile .st-label { color: var(--ink-soft); font-size: .82rem; font-weight: 660; margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.stat-tile { padding: 22px 20px; }
.bar-row { display: flex; align-items: center; gap: 11px; margin: 9px 0; min-width: 0; }
.bar-row .bl { width: 132px; flex: 0 0 132px; font-size: .86rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.bar-row .bt { flex: 1; height: 13px; background: #e4edec; border-radius: 999px; overflow: hidden; }
.bar-row .bt > i { display: block; height: 100%; background: var(--grad); border-radius: 999px; box-shadow: var(--glow); animation: growBar 1s var(--ease) both; transform-origin: left; }
@keyframes growBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bar-row .bv { width: 68px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 750; font-size: .86rem; }

/* ── Genome browser (Canvas, UCSC-style) ────────────────────────────────── */
.gb-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.gb-toolbar .btn.sm { padding: 7px 10px; }
.gb-region { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; font-weight: 700; color: var(--primary-ink); background: var(--grad-soft); border: 1px solid rgba(20,184,166,.2); padding: 6px 11px; border-radius: 8px; white-space: nowrap; }
.gb-count { font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.gb-overview { position: relative; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface); overflow: hidden; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.gb-overview canvas { display: block; width: 100%; height: 54px; cursor: crosshair; }
.gb-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 2px 12px; }
.gb-legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--ink-soft); font-weight: 600; cursor: pointer; opacity: .95; transition: opacity .15s; }
.gb-legend .lg.off { opacity: .35; text-decoration: line-through; }
.gb-legend .lg .sw { width: 15px; height: 11px; border-radius: 3px; }
.gb-canvas { position: relative; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm); }
#gb-main { display: block; width: 100%; cursor: grab; touch-action: none; }
#gb-main.drag { cursor: grabbing; }
.gb-tip { position: fixed; z-index: 200; pointer-events: none; background: #0c2224; color: #eafcf8; border: 1px solid rgba(255, 255, 255, .14); border-radius: 10px; padding: 9px 12px; font-size: .8rem; box-shadow: var(--shadow-pop); max-width: 300px; opacity: 0; transition: opacity .12s; line-height: 1.5; }
.gb-tip b { color: var(--teal-bright); }
.gb-tip .mono { color: #bfeee7; }
.gb-hint { font-size: .78rem; color: var(--muted); margin: 8px 2px 0; }

/* suggestion chips (AI consult) */
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest .chip { padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft); font-weight: 620; font-size: .85rem; cursor: pointer; text-align: left; transition: all .2s var(--ease); }
.suggest .chip:hover { border-color: transparent; color: var(--primary-ink); background: var(--grad-soft); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* teal range slider (browser position + protein zoom) */
.gb-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--teal) var(--v, 0%), #dde7e7 var(--v, 0%), #dde7e7 100%);
  outline: none; cursor: pointer; margin: 0; }
.gb-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--teal); box-shadow: var(--glow); cursor: grab; transition: transform .12s; }
.gb-slider::-webkit-slider-thumb:active { transform: scale(1.2); cursor: grabbing; }
.gb-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--teal); box-shadow: var(--glow); cursor: grab; }
.gb-pos-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.gb-pos-wrap .lbl { font-size: .74rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.gene-model { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin: 8px 0; }
.gene-model .ex { height: 14px; background: var(--grad); border-radius: 3px; }
.gene-model .in { height: 2px; background: var(--muted); flex: 0 0 auto; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.empty { text-align: center; color: var(--muted); padding: 44px 20px; }
.empty .big-ic { opacity: .45; margin-bottom: 12px; color: var(--primary); }
.spinner-sm { width: 16px; height: 16px; border: 2px solid rgba(20, 184, 166, .2); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -2px; }
.chat-msg { padding: 13px 16px; border-radius: var(--radius); margin-bottom: 11px; max-width: 85%; animation: msgIn .4s var(--ease) both; line-height: 1.65; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.chat-msg.me { background: var(--grad); color: #fff; margin-left: auto; box-shadow: var(--glow); }
.chat-msg.ai { background: var(--surface); border: 1px solid var(--border-soft); box-shadow: var(--shadow-sm); }
.chat-msg strong { color: var(--primary-ink); font-weight: 720; }
.chat-msg.me strong { color: #fff; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.flex { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.muted-txt { color: var(--ink-soft); }
.scrim { display: none; }

/* ── Entrance reveal ────────────────────────────────────────────────────── */
@keyframes revealUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.content > *, .site-wrap > * { animation: revealUp .5s var(--ease) both; }
.content > *:nth-child(1) { animation-delay: .02s; } .content > *:nth-child(2) { animation-delay: .08s; }
.content > *:nth-child(3) { animation-delay: .14s; } .content > *:nth-child(4) { animation-delay: .2s; }
.content > *:nth-child(5) { animation-delay: .26s; }
.site-wrap > *:nth-child(1) { animation-delay: .02s; } .site-wrap > *:nth-child(2) { animation-delay: .1s; }
.site-wrap > *:nth-child(3) { animation-delay: .18s; } .site-wrap > *:nth-child(4) { animation-delay: .26s; }
.kpi-grid .kpi { animation: revealUp .55s var(--ease) both; }
.kpi-grid .kpi:nth-child(1) { animation-delay: .05s; } .kpi-grid .kpi:nth-child(2) { animation-delay: .12s; }
.kpi-grid .kpi:nth-child(3) { animation-delay: .19s; } .kpi-grid .kpi:nth-child(4) { animation-delay: .26s; }
.stat-tiles .stat-tile { animation: revealUp .55s var(--ease) both; }
.stat-tiles .stat-tile:nth-child(1) { animation-delay: .05s; } .stat-tiles .stat-tile:nth-child(2) { animation-delay: .12s; }
.stat-tiles .stat-tile:nth-child(3) { animation-delay: .19s; } .stat-tiles .stat-tile:nth-child(4) { animation-delay: .26s; }
.list-item { animation: revealUp .45s var(--ease) both; }
.list-item:nth-child(1) { animation-delay: .03s; } .list-item:nth-child(2) { animation-delay: .07s; }
.list-item:nth-child(3) { animation-delay: .11s; } .list-item:nth-child(4) { animation-delay: .15s; }
.list-item:nth-child(5) { animation-delay: .19s; } .list-item:nth-child(6) { animation-delay: .23s; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .cols-2 { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .hamburger { display: grid; }
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); transition: transform .32s var(--ease); box-shadow: var(--shadow-pop); width: var(--sidebar-w); flex-basis: var(--sidebar-w); }
  .app.drawer-open .sidebar { transform: none; }
  .app.collapsed .sidebar { width: var(--sidebar-w); flex-basis: var(--sidebar-w); }
  .app.collapsed .brand-name, .app.collapsed .brand-sub, .app.collapsed .nav .nav-label, .app.collapsed .nav-section, .app.collapsed .side-lang-label { opacity: 1; width: auto; height: auto; }
  .app.drawer-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 30, 32, .42); backdrop-filter: blur(3px); z-index: 39; animation: fade .3s var(--ease); }
  .content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .kpi { padding: 15px; gap: 12px; }
  .kpi .gauge { width: 52px; height: 52px; flex-basis: 52px; }
  .kpi .kpi-val { font-size: 1.4rem; }
  .site-wrap { padding: 16px 14px 54px; }
  .hero { padding: 26px 20px; }
  .hero h1 { font-size: 1.5rem; }
  .hero .sci { font-size: 1.5rem; }
  .modal { width: 96vw; max-height: 92vh; }
  .list-item .li-sub { white-space: normal; }
}

/* ═══ Collapsed sidebar — clean icon-only centering (desktop) ═══ */
@media (min-width: 721px) {
  .app.collapsed .brand-txt,
  .app.collapsed .nav .nav-label,
  .app.collapsed .nav-section,
  .app.collapsed .nav-logout .nav-label,
  .app.collapsed .collapse-row .nav-label,
  .app.collapsed .side-lang-label { display: none; }
  .app.collapsed .brand { justify-content: center; gap: 0; padding: 18px 8px; }
  .app.collapsed .nav { padding: 12px 10px; }
  .app.collapsed .nav a,
  .app.collapsed .nav-logout,
  .app.collapsed .collapse-row { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
  .app.collapsed .nav a .ic,
  .app.collapsed .nav-logout .ic,
  .app.collapsed .collapse-row .ic { flex: 0 0 24px; }
  .app.collapsed .nav-section { height: 0; margin: 8px 0; padding: 0; border-top: 1px solid var(--side-brd); }
  .app.collapsed .sidebar-foot { padding: 10px 8px; gap: 6px; }
  .app.collapsed .side-lang { flex-direction: column; gap: 4px; width: 100%; }
  .app.collapsed .side-lang button { padding: 7px 0; font-size: .72rem; }
}

/* ═══ Markdown rendering (AI answers) ═══ */
.md-body { line-height: 1.68; }
.md-body > *:first-child { margin-top: 0; }
.md-body > *:last-child { margin-bottom: 0; }
.md-body p { margin: 0 0 10px; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 14px 0 8px; line-height: 1.3; }
.md-body h1 { font-size: 1.25rem; } .md-body h2 { font-size: 1.13rem; } .md-body h3 { font-size: 1.02rem; } .md-body h4 { font-size: .95rem; }
.md-body ul, .md-body ol { margin: 6px 0 12px; padding-left: 22px; }
.md-body li { margin: 3px 0; }
.md-body strong { font-weight: 720; color: var(--primary-ink); }
.md-body.on-teal strong { color: #eafcf8; }
.md-body em { font-style: italic; }
.md-body code { font-family: ui-monospace, Menlo, Consolas, monospace; background: rgba(20,184,166,.1); color: var(--teal-deep); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
.md-body pre.md-pre { background: #0c2224; color: #d7f5ef; border-radius: 10px; padding: 12px 14px; overflow-x: auto; margin: 10px 0; }
.md-body pre.md-pre code { background: none; color: inherit; padding: 0; }
.md-body blockquote { border-left: 3px solid var(--teal); margin: 10px 0; padding: 4px 0 4px 14px; color: var(--ink-soft); }
.md-body a { color: var(--primary-ink); text-decoration: underline; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.md-body table { border-collapse: collapse; margin: 10px 0; font-size: .9em; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 6px 10px; }
.md-body th { background: var(--surface-2); }

/* consult page chrome */
.consult-msgs { display: flex; flex-direction: column; }
.chat-msg.ai { max-width: 100%; }
.chat-msg.me { max-width: 85%; }
.consult-head { display: flex; align-items: center; gap: 10px; }
.suggest-wrap { margin-top: 14px; }

/* markdown table wrapper + message actions */
.md-tablewrap { overflow-x: auto; margin: 10px 0; }
.md-body table { width: auto; min-width: 60%; }
.msg-actions { display: flex; gap: 6px; margin-top: 10px; opacity: .7; transition: opacity .2s; }
.chat-msg:hover .msg-actions { opacity: 1; }
.msg-actions .btn.sm { padding: 4px 10px; font-size: .78rem; }

/* command palette */
.gpal-backdrop { position: fixed; inset: 0; background: rgba(10,30,32,.5); backdrop-filter: blur(4px); z-index: 400; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.gpal-backdrop.on { display: flex; animation: fade .18s var(--ease); }
.gpal { width: min(620px, 94vw); background: var(--surface); border: 1px solid var(--border-soft); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; animation: modalIn .25s var(--ease); }
.gpal-in { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.gpal-ic { color: var(--muted); display: grid; place-items: center; }
.gpal-in input { flex: 1; border: none; outline: none; font-size: 1.05rem; background: transparent; color: var(--ink); }
.gpal-list { max-height: 52vh; overflow-y: auto; }
.gpal-item { display: flex; align-items: center; gap: 10px; padding: 11px 18px; cursor: pointer; }
.gpal-item.active { background: var(--grad-soft); }
.gpal-sym { font-weight: 750; }
.gpal-name { flex: 1; color: var(--ink-soft); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gpal-empty { padding: 26px; text-align: center; color: var(--muted); }
.gpal-foot { padding: 9px 18px; border-top: 1px solid var(--border-soft); font-size: .76rem; color: var(--muted); background: var(--surface-2); }

/* ── Splash screen ──────────────────────────────────────────────────────── */
#gb-splash { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: radial-gradient(circle at 50% 38%, #0f3a3b, #071a1b 75%); transition: opacity .55s ease, visibility .55s; }
#gb-splash.hide { opacity: 0; visibility: hidden; }
#gb-splash .sp-in { text-align: center; }
#gb-splash img { width: 96px; height: 96px; filter: drop-shadow(0 10px 34px rgba(20,184,166,.7)); animation: splashPulse 1.6s ease-in-out infinite; }
#gb-splash .sp-name { color: #eafcf8; font-weight: 850; font-size: 1.5rem; margin-top: 16px; letter-spacing: -.02em; }
#gb-splash .sp-bar { width: 150px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.14); margin: 18px auto 0; overflow: hidden; }
#gb-splash .sp-bar i { display: block; height: 100%; width: 40%; background: var(--grad-bright); border-radius: 999px; animation: splashBar 1.1s ease-in-out infinite; }
@keyframes splashPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes splashBar { 0% { margin-left: -40%; } 100% { margin-left: 110%; } }

/* ═══ Comprehensive mobile optimization ═══ */
@media (max-width: 860px) {
  #pp-grid { grid-template-columns: 1fr !important; }
  .cols-2 { grid-template-columns: 1fr; }
  .content { max-width: 100%; }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar .crumb { font-size: .88rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
  .topbar .crumb .home { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
  .model-badge { font-size: .7rem; padding: 5px 9px; }
  .content { padding: 14px; }
  .page-head { gap: 8px; margin-bottom: 16px; }
  .page-head h1 { font-size: 1.28rem; }
  .card { padding: 16px; border-radius: 14px; }
  .card.pad-lg { padding: 18px; }
  .kpi .kpi-val { font-size: 1.55rem; }
  .stat-tile .st-val { font-size: 1.7rem; }
  .hero { padding: 22px 18px; border-radius: 18px; }
  .hero h1 { font-size: 1.4rem; }
  .hero .sci { font-size: 1.45rem; }
  .hero .common { font-size: .95rem; }
  .stat-tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
  .gb-toolbar { gap: 6px; }
  .gb-toolbar .input, .gb-toolbar .select { max-width: none !important; flex: 1 1 130px; min-width: 0; }
  .seg button { padding: 6px 11px; }
  .modal-foot { flex-direction: column-reverse; align-items: stretch; }
  .modal-foot .btn { width: 100%; }
  .modal-foot label { margin-right: 0 !important; justify-content: center; }
  table.data th, table.data td { padding: 10px 12px; }
  #viewer { height: 380px !important; }
  .list-item { padding: 12px 13px; gap: 11px; }
  .list-item .li-avatar { width: 38px; height: 38px; flex-basis: 38px; }
  .site-wrap { padding: 14px 12px 48px; }
  .gb-legend { gap: 5px 10px; }
}
@media (max-width: 430px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .stat-tiles { grid-template-columns: 1fr; }
  .page-head .btn .nav-label, .page-head .btn span:not(.ic) { }
  .hero h1 { font-size: 1.25rem; }
}
/* larger tap targets + no accidental horizontal overflow on phones */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  .btn, .icon-btn, .seg button, .chip { min-height: 40px; }
  .field .input, .select { min-height: 46px; }
}

/* ── Scientific-name autocomplete (species add dialog) ────────────────────── */
/* dropdown is fixed-positioned on <body> (above the modal, z 300) so the
   modal-body overflow never clips it; JS sets left/top/width from the input */
.ac-list {
  position: fixed; z-index: 400;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
  max-height: 300px; overflow-y: auto; padding: 5px;
}
.ac-item {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 8px 11px; border-radius: 8px; cursor: pointer; line-height: 1.35;
}
.ac-item.active { background: var(--grad-soft); }
.ac-sci { font-weight: 680; font-style: italic; color: var(--ink); }
.ac-common { font-size: .82rem; color: var(--ink-soft); }
.ac-group { font-size: .72rem; color: var(--muted); margin-left: auto; white-space: nowrap; }

/* Stat numbers stay on one line; app.js fitNumber() shrinks the font to fit. */
.kpi .kpi-val, .stat-tile .st-val { white-space: nowrap; }

/* ── PWA install button (floating, bottom-right; toast lives top-right) ────── */
.gb-install {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 150;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 17px;
  font: inherit; font-weight: 650; font-size: .92rem;
  color: #fff; background: var(--grad); border: none;
  border-radius: 999px; cursor: pointer;
  box-shadow: var(--glow), var(--shadow);
  opacity: 0; transform: translateY(16px) scale(.96);
  transition: opacity .3s var(--ease), transform .3s var(--ease), box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.gb-install.show { opacity: 1; transform: translateY(0) scale(1); }
.gb-install:hover { box-shadow: var(--glow-strong), var(--shadow-pop); transform: translateY(-1px) scale(1.02); }
.gb-install:active { transform: translateY(0) scale(.98); }
.gb-install .ic-svg { display: block; }
.pwa-ios { line-height: 1.7; color: var(--ink-soft); }
.pwa-ios-glyph { display: inline-flex; vertical-align: middle; color: var(--primary-ink); }
@media (max-width: 640px) {
  .gb-install { min-height: 44px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .gb-install { transition: opacity .2s; transform: none; }
  .gb-install.show { transform: none; }
}
