/* Organised layout: tabs, grouped tables, product cells, detail drawer with dated history. Loaded last. */

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); overflow-x: auto; scrollbar-width: none; margin-top: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px 12px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 13.5px; white-space: nowrap; border-radius: 8px 8px 0 0; transition: color .15s, background .15s; }
.tabs a:hover { color: var(--ink); background: var(--hover); }
.tabs a svg { width: 16px; height: 16px; }
.tabs a b { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--hover); color: var(--ink-2); }
.tabs a.on { color: var(--ink); }
.tabs a.on svg { color: var(--accent); }
.tabs a.on b { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--ink); }
.tabs a.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); animation: tab-in .3s var(--ease); }
@keyframes tab-in { from { transform: scaleX(.3); opacity: 0; } }

/* ---------- tables ---------- */
tr.grp td { background: color-mix(in srgb, var(--accent) 7%, var(--surface-2)); font-size: 13px; font-weight: 600; color: var(--ink); padding: 8px 12px; border-bottom: 1px solid var(--line-strong); position: sticky; top: 33px; z-index: 1; }
tr.grp td .muted { font-weight: 500; margin-left: 4px; }
tbody tr.grp:hover td { background: color-mix(in srgb, var(--accent) 7%, var(--surface-2)); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
td { vertical-align: middle; }
.pcell { display: grid; gap: 1px; min-width: 160px; }
.pcell b { font-weight: 600; }
.pcell small { color: var(--ink-3); font-size: 11.5px; }
.note1 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 380px; color: var(--ink-2); font-size: 12.5px; }
.stage { display: inline-grid; gap: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.stage i { display: block; width: 92px; height: 5px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line-strong) var(--p)); }

/* ---------- drawer ---------- */
.drawer-wrap { position: fixed; inset: 0; z-index: 85; background: rgba(6, 20, 34, .4); display: flex; justify-content: flex-end; animation: fade-in .18s; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--surface); border-left: 1px solid var(--line-strong); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: drawer-in .28s var(--ease); }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
.drawer > header { display: flex; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); border-top: 4px solid var(--accent); }
.drawer h2 { font-size: 18px; font-weight: 750; font-stretch: 106%; line-height: 1.25; }
.drawer header p { margin: 3px 0 0; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px 28px; display: grid; gap: 20px; align-content: start; scrollbar-width: thin; }
.dhead { display: flex; gap: 12px; align-items: center; }
.facts { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 13px; }
.facts dt, .facts dd { padding: 8px 12px; border-bottom: 1px solid var(--line); margin: 0; }
.facts dt { color: var(--ink-3); font-weight: 600; background: var(--surface-2); }
.facts dd { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; white-space: pre-line; }
.facts dt:nth-last-of-type(1), .facts dd:last-child { border-bottom: 0; }
.dsec h3, .hist h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.dsec p { margin: 0; color: var(--ink-2); font-size: 13px; white-space: pre-line; }
.hist ol { list-style: none; margin: 0; padding: 0 0 0 18px; position: relative; display: grid; gap: 12px; }
.hist ol::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line-strong); border-radius: 2px; }
.hist li { position: relative; display: grid; gap: 2px; }
.hist li::before { content: ""; position: absolute; left: -18px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.hist li.latest::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.hdate { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.hist li.latest .hdate { color: var(--accent); }
.hist p { margin: 0; font-size: 13px; color: var(--ink); line-height: 1.45; }
.gapbox { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gapbox div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; background: var(--surface-2); }
.gapbox b { font-size: 22px; font-weight: 750; }
.gapbox span { font-size: 12px; color: var(--ink-2); }
.drawer .jtrack { margin-top: 2px; }

@media (max-width: 640px) {
  .facts { grid-template-columns: 1fr; }
  .facts dt { border-bottom: 0; padding-bottom: 2px; }
}
