/* Genetidoc TopGenes. Same structure and palette as GC Notes / Contact Sorter. */
:root {
  --blue: #3E3E7E; --blue-d: #2e2e63; --blue-l: #eceefc; --blue-m: #c9cdf6; --accent: #5E6CE6;
  --pink: #E84E85; --pink-l: #fdeaf1; --cream: #FFF3E8; --mist: #F7F9FC;
  --ink: #232a3d; --ink-2: #35405B; --ink-3: #7b8794; --line: #e3e8ee; --bg: #f5f7fb; --card: #fff;
  --green: #1b8a5a; --green-l: #e5f5ed; --red: #c62828; --red-l: #fdecec; --amber: #9a5b00; --amber-l: #fff4e0;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
h2 { font-size: 15px; margin: 0; color: var(--blue); }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: #f0f2f8; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: #4b58d0; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eef1f7; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.icon { padding: 4px 8px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #d3d9e4; border-radius: 8px; padding: 8px 10px; background: #fff; outline: none; }
textarea.input { resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--blue-l); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-weight: 500; margin-bottom: 4px; font-size: 13px; color: var(--ink-2); }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; cursor: pointer; }
.check input { margin-top: 3px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--blue-l) 0%, var(--cream) 100%); }
.login-card { width: 380px; background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 10px 40px rgba(62,62,126,.14); }
.login-card img { height: 46px; }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 6px 0; }

/* top bar */
.topbar { height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; padding: 0 18px; position: sticky; top: 0; z-index: 20; }
.topbar .logo { height: 30px; margin-right: 10px; }
.topbar .spacer { flex: 1; }
.nav a { padding: 7px 11px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: #f0f2f8; }
.nav a.active { background: var(--blue-l); color: var(--blue); }
.page { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.page h1 { font-size: 22px; margin: 0; color: var(--blue); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-3); background: #fff; border: 1px dashed #cfd6e3; border-radius: 12px; margin-top: 14px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: #eef1f6; color: var(--ink-2); white-space: nowrap; }
.pill.blue { background: var(--blue-l); color: var(--blue); }
.pill.green { background: var(--green-l); color: var(--green); }
.pill.amber { background: var(--amber-l); color: var(--amber); }
.pill.pink { background: var(--pink-l); color: #b8285c; }
.pill.red { background: var(--red-l); color: var(--red); }

/* tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
th { background: #f9fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tbody.click tr { cursor: pointer; }
tbody.click tr:hover { background: #f7f8ff; }

.spinner { width: 18px; height: 18px; border: 2px solid var(--blue-m); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
/* modal */
.overlay { position: fixed; inset: 0; background: rgba(20,22,45,.45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 540px; max-width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal.wide { width: 860px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 16px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; align-items: center; position: sticky; bottom: 0; background: #fff; }
.drop { border: 2px dashed #c4cbe6; border-radius: 12px; padding: 26px; text-align: center; cursor: pointer; background: #fafbff; }
.drop.over { border-color: var(--accent); background: var(--blue-l); }
.drop img { max-width: 100%; max-height: 220px; border-radius: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 10px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 90vw; }
.toast.err { background: var(--red); }

/* ---------- TopGenes ---------- */
.hint { background: var(--amber-l); color: #6b4300; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 14px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); }
.tabs a .n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--blue-l); color: var(--blue); font-size: 12px; text-align: center; }
.casehead { display: grid; grid-template-columns: 1.4fr .8fr .8fr auto; gap: 0 12px; align-items: end; }
.addgrid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 14px; }
.addgrid .card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.addgrid h3 { margin: 0; font-size: 14px; color: var(--blue); }
.rec { display: flex; align-items: center; gap: 10px; }
.rec .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; }
.uplist { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.src { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.src summary { cursor: pointer; display: flex; gap: 8px; align-items: center; list-style: none; }
.src summary::-webkit-details-marker { display: none; }
.src pre { white-space: pre-wrap; font: inherit; font-size: 13px; background: var(--mist); border-radius: 8px; padding: 10px; margin: 8px 0 0; max-height: 340px; overflow: auto; border: 1px solid var(--line); }
.bigbtn { font-size: 15px; padding: 10px 18px; }
.searchbox { position: relative; }
.results-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 30; max-height: 440px; overflow-y: auto; }
.sr { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 12px; border-bottom: 1px solid #eef1f4; align-items: center; }
.sr:last-child { border-bottom: 0; }
.sr .d { font-size: 12px; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr .mt { font-size: 12px; color: var(--accent); }
.frow { display: grid; grid-template-columns: 38px 1fr auto auto 26px; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid #eef1f4; }
.frow.off { opacity: .45; }
.frow .nm { font-weight: 500; }
.frow .ph { font-size: 12px; color: var(--ink-3); }
.seg { display: inline-flex; border: 1px solid #d3d9e4; border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 5px 10px; cursor: pointer; font-size: 13px; border-right: 1px solid #d3d9e4; }
.seg button:last-child { border-right: 0; }
.seg button.on.present { background: var(--green); color: #fff; }
.seg button.on.absent { background: var(--red); color: #fff; }
.seg button.on.unsure { background: var(--ink-3); color: #fff; }
.switch { position: relative; width: 34px; height: 20px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd6e3; border-radius: 99px; cursor: pointer; transition: .15s; }
.switch span:before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span:before { transform: translateX(14px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--blue-m); }
.resgrid { display: grid; grid-template-columns: 400px 1fr; gap: 16px; align-items: start; }
.sugg { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: #fff; }
.sugg .why { font-size: 12px; color: var(--ink-3); margin: 2px 0 8px; }
.bar { height: 6px; background: #eef1f6; border-radius: 99px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; }
.bar i { display: block; height: 100%; background: var(--accent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.unlikely td { color: var(--ink-3); }
tr.unlikely .bar i { background: #c4cbe6; }
.contrib { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: #eef1f6; }
.chip.up { background: var(--green-l); color: var(--green); }
.chip.down { background: var(--red-l); color: var(--red); }
.fam { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.sum { min-height: 120px; }
@media (max-width: 1100px) {
  .resgrid, .addgrid { grid-template-columns: 1fr; }
  .casehead { grid-template-columns: 1fr 1fr; }
  .frow { grid-template-columns: 38px 1fr 26px; }
  .frow .seg, .frow .pills { grid-column: 2 / 4; }
}
