:root {
  --bg: #f4f8f7;
  --surface: #fff;
  --surface-2: #edf3f1;
  --surface-3: #e4eeeb;
  --text: #102522;
  --text-2: #536a66;
  --text-3: #758985;
  --line: #d6e1de;
  --line-strong: #b8c9c5;
  --primary: #0b6b60;
  --primary-2: #0e8577;
  --primary-soft: #d8f0e9;
  --accent: #d95d2c;
  --danger: #bd3e3e;
  --warning: #ad6b08;
  --shadow: 0 18px 60px rgba(23, 58, 51, .1);
  --shadow-sm: 0 8px 24px rgba(23, 58, 51, .08);
  --radius: 18px;
  --radius-sm: 11px;
  --font: Inter, "Avenir Next", Avenir, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
}

html[data-theme="dark"] {
  --bg: #101715;
  --surface: #17201e;
  --surface-2: #1d2926;
  --surface-3: #263431;
  --text: #edf7f4;
  --text-2: #adc1bc;
  --text-3: #819993;
  --line: #2d3c38;
  --line-strong: #445650;
  --primary: #4fd1bb;
  --primary-2: #7fe2d1;
  --primary-soft: #173d36;
  --accent: #f28b62;
  --danger: #ff8888;
  --warning: #e9ac51;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; transform: translateY(-160%); padding: 10px 14px; border-radius: 8px; background: var(--text); color: var(--bg); }
.skip-link:focus { transform: none; }

.site-header { position: sticky; top: 0; z-index: 50; height: 76px; padding: 0 clamp(20px, 4vw, 64px); display: grid; grid-template-columns: 260px minmax(280px, 620px) 1fr; align-items: center; gap: 26px; border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; width: max-content; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--primary); background: var(--primary-soft); }
.brand-mark svg { width: 25px; height: 25px; stroke-width: 1.3; }
.brand-mark .brand-liquid { fill: currentColor; stroke: none; opacity: .28; }
.brand-copy { display: block; min-width: 0; }
.brand strong { display: block; font-size: 18px; letter-spacing: -.03em; line-height: 1.05; }
.brand-oneliner { display: inline-flex; align-items: center; gap: 7px; margin-top: 3px; }
.brand small { display: block; margin: 0; color: var(--text-3); font-size: 9px; text-transform: uppercase; letter-spacing: .18em; }
.site-beta-badge { flex: 0 0 auto; padding: 3px 6px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font: 800 7px var(--mono); letter-spacing: .1em; line-height: 1.2; }
.mcp-config-link { min-width: 42px; min-height: 42px; display: inline-grid; place-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--primary); background: var(--surface); font: 800 10px var(--mono); letter-spacing: .08em; text-decoration: none; }
.mcp-config-link:hover { border-color: var(--line-strong); background: var(--surface-2); }
.header-search { height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 2px 10px rgba(34, 70, 62, .03); }
.header-search svg { width: 19px; color: var(--text-3); }
.header-search input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; }
.header-search input::placeholder { color: var(--text-3); }
kbd { padding: 2px 7px; border: 1px solid var(--line); border-bottom-color: var(--line-strong); border-radius: 6px; color: var(--text-3); background: var(--surface-2); font: 11px var(--mono); }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.icon-button, .language-button { min-width: 42px; min-height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .2s, color .2s, background .2s, transform .2s; }
.icon-button:hover, .language-button:hover { border-color: var(--line-strong); color: var(--primary); background: var(--surface-2); }
.icon-button:active, .language-button:active { transform: scale(.97); }
.icon-button svg { width: 19px; height: 19px; }
.language-button { padding: 0 12px; font-size: 12px; font-weight: 700; }

.hero { min-height: 600px; padding: 90px clamp(24px, 7vw, 112px) 84px; display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(340px, .72fr); align-items: center; gap: clamp(50px, 8vw, 130px); position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; top: -240px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--primary) 13%, transparent), transparent 68%); pointer-events: none; }
.eyebrow { margin: 0 0 16px; display: flex; align-items: center; gap: 9px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow > span:first-child { width: 24px; height: 1px; background: currentColor; }
.eyebrow b { font: inherit; }
.hero h1 { max-width: 820px; margin: 0; font-size: clamp(42px, 6.1vw, 84px); line-height: .99; letter-spacing: -.065em; font-weight: 700; }
.hero h1 em { color: var(--primary); font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.hero-lede { max-width: 680px; margin: 28px 0 32px; color: var(--text-2); font-size: clamp(16px, 1.4vw, 19px); line-height: 1.7; }
.hero-search { max-width: 720px; min-height: 64px; display: flex; align-items: center; padding: 7px 8px 7px 19px; gap: 12px; border: 1px solid var(--line-strong); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow-sm); }
.hero-search svg { width: 22px; color: var(--text-3); flex: 0 0 auto; }
.hero-search input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 16px; }
.hero-search button, .primary-button { min-height: 48px; padding: 0 20px; border: 0; border-radius: 11px; color: white; background: var(--primary); font-weight: 700; cursor: pointer; transition: background .2s, transform .2s; }
.hero-search button:hover, .primary-button:hover { background: var(--primary-2); }
.hero-search button:active, .primary-button:active { transform: scale(.98); }
.popular-links { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--text-3); font-size: 12px; }
.popular-links span { margin-right: 4px; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; font-weight: 700; }
.popular-links button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text-2); cursor: pointer; }
.popular-links button:hover { border-color: var(--primary); color: var(--primary); }

.hero-panel { position: relative; padding: 26px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); transform: rotate(1.4deg); }
.hero-panel::before { content: ""; position: absolute; inset: 8px -10px -10px 8px; z-index: -1; border: 1px solid var(--line); border-radius: 24px; background: var(--surface-2); }
.panel-topline { display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.live-dot { display: flex; align-items: center; gap: 7px; color: var(--primary); }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px var(--primary-soft); }
.equation-row { margin: 32px 0 25px; display: flex; justify-content: center; align-items: center; gap: 19px; color: var(--text); font: 500 clamp(28px, 3vw, 42px) var(--mono); }
.equation-row b { color: var(--primary); }
.mini-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-inputs div { padding: 13px; border-radius: 10px; background: var(--surface-2); }
.mini-inputs small, .example-result small { display: block; margin-bottom: 6px; color: var(--text-3); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.mini-inputs strong { font: 500 13px var(--mono); }
.example-result { margin-top: 15px; padding: 19px; border-radius: 13px; color: var(--text); background: var(--primary-soft); }
.example-result strong { display: block; color: var(--primary); font: 500 32px var(--mono); letter-spacing: -.04em; }
.example-result span { color: var(--text-2); font-size: 13px; }
.pipette-note { margin-top: 14px; display: flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 12px; }
.pipette-note svg { width: 17px; color: var(--primary); }

.trust-strip { margin: 0 clamp(20px, 4vw, 64px); display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); }
.trust-strip div { min-height: 94px; display: flex; justify-content: center; align-items: center; gap: 12px; border-right: 1px solid var(--line); }
.trust-strip div:last-child { border-right: 0; }
.trust-strip strong { font: 500 22px var(--mono); color: var(--primary); }
.trust-strip span { max-width: 100px; color: var(--text-3); font-size: 11px; line-height: 1.35; text-transform: uppercase; letter-spacing: .08em; }

.tools-section { padding: 85px clamp(20px, 4vw, 64px) 120px; display: grid; grid-template-columns: 225px minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); }
.tool-sidebar { position: sticky; top: 105px; align-self: start; }
.sidebar-heading { margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; }
.sidebar-heading span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.sidebar-heading button { border: 0; background: none; color: var(--primary); font-size: 11px; font-weight: 700; cursor: pointer; }
#category-list { display: grid; gap: 5px; }
.category-button { width: 100%; min-height: 45px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text-2); text-align: left; cursor: pointer; transition: background .2s, border-color .2s, color .2s; }
.category-button svg { width: 18px; }
.category-button span { flex: 1; font-size: 13px; font-weight: 600; }
.category-button small { color: var(--text-3); font: 10px var(--mono); }
.category-button:hover, .category-button.active { border-color: var(--line); color: var(--primary); background: var(--surface); }
.sidebar-note { margin-top: 28px; padding: 16px; display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.sidebar-note svg { width: 20px; flex: 0 0 auto; color: var(--primary); }
.sidebar-note strong, .sidebar-note span { display: block; }
.sidebar-note strong { margin-bottom: 3px; font-size: 11px; }
.sidebar-note span { color: var(--text-3); font-size: 10px; line-height: 1.45; }
.content-heading { margin-bottom: 28px; display: flex; justify-content: space-between; align-items: end; gap: 30px; }
.content-heading h2 { margin: 0; font-size: clamp(28px, 3.2vw, 44px); line-height: 1.1; letter-spacing: -.045em; }
.content-heading > p { color: var(--text-3); font: 11px var(--mono); white-space: nowrap; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tool-card { min-height: 210px; padding: 20px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .2s, transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s; }
.tool-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.tool-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 2px; }
.card-top { display: flex; justify-content: space-between; align-items: start; }
.tool-icon { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; color: var(--primary); background: var(--primary-soft); }
.tool-icon svg { width: 21px; height: 21px; }
.card-favorite { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--text-3); cursor: pointer; }
.card-favorite svg { width: 16px; }
.card-favorite:hover, .card-favorite.active { color: var(--accent); background: var(--surface-2); }
.card-favorite.active svg { fill: currentColor; }
.tool-card h3 { margin: 18px 0 6px; font-size: 15px; letter-spacing: -.02em; }
.tool-card p { margin: 0; flex: 1; color: var(--text-3); font-size: 12px; line-height: 1.55; }
.card-meta { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.card-meta span:last-child { display: flex; align-items: center; gap: 5px; color: var(--primary); }
.card-meta svg { width: 13px; }
.empty-state { padding: 80px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 18px; }
.empty-state svg { width: 35px; color: var(--text-3); }
.empty-state h3 { margin: 18px 0 6px; }
.empty-state p { margin: 0; color: var(--text-3); }

.brand-bridge { margin: 0 clamp(20px, 4vw, 64px) 70px; padding: clamp(30px, 5vw, 65px); display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 30px 70px; border-radius: 26px; color: #eaf8f5; background: #113c37; overflow: hidden; position: relative; }
.brand-bridge::after { content: ""; position: absolute; width: 320px; height: 320px; right: -100px; top: -130px; border-radius: 50%; background: radial-gradient(circle, rgba(93, 211, 188, .2), transparent 70%); }
.brand-bridge .eyebrow { color: #76d8c5; }
.brand-bridge h2 { margin: 0; max-width: 600px; font-size: clamp(30px, 4vw, 54px); line-height: 1.05; letter-spacing: -.05em; }
.brand-bridge > p { margin: 0; color: #aac8c2; font-size: 14px; line-height: 1.8; }
.bridge-actions { grid-column: 1 / -1; display: flex; gap: 10px; }
.bridge-actions a { min-height: 47px; display: inline-flex; align-items: center; padding: 0 18px; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; color: #eaf8f5; text-decoration: none; font-size: 12px; font-weight: 700; }
.bridge-actions .primary-link { border-color: #70d4c0; color: #092b27; background: #70d4c0; }

footer { padding: 35px clamp(20px, 4vw, 64px) 60px; display: grid; grid-template-columns: 220px 1fr auto; align-items: center; gap: 30px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 11px; }
.footer-brand { display: block; }
footer p { max-width: 630px; margin: 0; }
footer > div { display: flex; align-items: center; gap: 12px; }
footer button { padding: 0; border: 0; background: none; color: var(--text-3); cursor: pointer; }
footer button:hover { color: var(--primary); }

.tool-dialog { width: min(1100px, calc(100vw - 32px)); max-height: min(880px, calc(100vh - 28px)); padding: 0; border: 0; border-radius: 22px; color: var(--text); background: var(--surface); box-shadow: 0 40px 130px rgba(0,0,0,.3); overflow: hidden; }
.tool-dialog::backdrop, .info-dialog::backdrop { background: rgba(10, 23, 20, .68); backdrop-filter: blur(5px); }
.dialog-shell { display: flex; flex-direction: column; max-height: inherit; }
.dialog-header { min-height: 100px; padding: 19px 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.dialog-identity { display: flex; align-items: center; gap: 15px; min-width: 0; }
.dialog-identity > div { min-width: 0; }
.dialog-identity p { margin: 0 0 2px; color: var(--primary); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.dialog-identity h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.dialog-identity > div > span { display: block; margin-top: 2px; color: var(--text-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions #favorite-tool.active { color: var(--accent); }
.dialog-actions #favorite-tool.active svg { fill: currentColor; }
.dialog-body { min-height: 520px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(350px, .95fr); overflow: hidden; }
.calculator-pane, .result-pane { padding: 26px; overflow: auto; }
.result-pane { border-left: 1px solid var(--line); background: var(--surface-2); }
.dialog-footer { min-height: 65px; padding: 12px 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 10px; }
.dialog-footer button { min-height: 40px; padding: 0 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; }
.dialog-footer button:disabled { opacity: .45; cursor: not-allowed; }
.dialog-footer button:not(:disabled):hover { border-color: var(--primary); color: var(--primary); }

.tool-form { display: grid; gap: 18px; }
.form-section { display: grid; gap: 13px; }
.form-section + .form-section { padding-top: 17px; border-top: 1px solid var(--line); }
.form-section-title { margin: 0; color: var(--text-2); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--text-2); font-size: 11px; font-weight: 700; }
.field small { color: var(--text-3); font-size: 9px; line-height: 1.4; }
.field input, .field select, .field textarea { width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--text); background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.field textarea { min-height: 112px; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.input-unit { display: grid; grid-template-columns: minmax(0, 1fr) 100px; }
.input-unit input { border-radius: 9px 0 0 9px; }
.input-unit select { border-left: 0; border-radius: 0 9px 9px 0; }
.form-actions { display: flex; gap: 9px; align-items: center; }
.form-actions button { min-height: 46px; padding: 0 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 700; font-size: 12px; }
.form-actions .calculate-button { flex: 1; border-color: var(--primary); color: white; background: var(--primary); }
.form-actions .calculate-button:hover { background: var(--primary-2); }
.form-help { padding: 13px; display: flex; gap: 9px; border-radius: 10px; color: var(--text-2); background: var(--surface-2); font-size: 10px; line-height: 1.55; }
.form-help svg { width: 16px; flex: 0 0 auto; color: var(--primary); }
.error-message { padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line)); border-radius: 9px; color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); font-size: 11px; }

.result-placeholder { min-height: 430px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; color: var(--text-3); }
.result-placeholder svg { width: 45px; opacity: .45; }
.result-placeholder h3 { margin: 20px 0 6px; color: var(--text-2); font-size: 15px; }
.result-placeholder p { margin: 0; font-size: 11px; }
.result-card { display: grid; gap: 15px; }
.result-kicker { color: var(--primary); font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.result-primary { padding: 20px; border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--line)); border-radius: 14px; background: var(--primary-soft); }
.result-primary small { display: block; margin-bottom: 4px; color: var(--text-2); font-size: 10px; }
.result-primary strong { display: block; color: var(--primary); font: 500 clamp(27px, 4vw, 42px) var(--mono); letter-spacing: -.05em; line-height: 1.15; overflow-wrap: anywhere; }
.result-primary span { color: var(--text-2); font-size: 11px; }
.result-list { display: grid; gap: 8px; }
.result-row { min-height: 45px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-radius: 9px; background: var(--surface); }
.result-row span { color: var(--text-3); font-size: 10px; }
.result-row strong { text-align: right; font: 500 12px var(--mono); }
.protocol-block { padding: 15px; border-left: 3px solid var(--primary); border-radius: 0 10px 10px 0; background: var(--surface); }
.protocol-block h4 { margin: 0 0 8px; font-size: 11px; }
.protocol-block ol, .protocol-block ul { margin: 0; padding-left: 17px; color: var(--text-2); font-size: 10px; line-height: 1.7; }
.warning-block { padding: 12px; display: flex; gap: 9px; border: 1px solid color-mix(in srgb, var(--warning) 25%, var(--line)); border-radius: 9px; color: var(--warning); background: color-mix(in srgb, var(--warning) 7%, transparent); font-size: 10px; }
.warning-block svg { width: 16px; flex: 0 0 auto; }
.result-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.result-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.result-table th, .result-table td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.result-table th:first-child, .result-table td:first-child { text-align: left; }
.result-table th { color: var(--text-3); background: var(--surface-2); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.result-table tr:last-child td { border-bottom: 0; }

.plate-controls, .map-controls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.plate-grid, .freezer-grid { display: grid; gap: 3px; min-width: max-content; padding: 8px; }
.plate-cell, .freezer-cell { min-width: 44px; min-height: 38px; padding: 4px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text-2); font: 8px var(--mono); cursor: pointer; overflow: hidden; }
.plate-cell.control { color: var(--primary); background: var(--primary-soft); }
.plate-cell.sample { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.freezer-cell.filled { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.map-scroll { margin-top: 14px; overflow: auto; }
.print-labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.print-label { min-height: 75px; padding: 8px; display: grid; place-items: center; text-align: center; border: 1px dashed var(--line-strong); border-radius: 6px; background: white; color: #15201e; font: 9px var(--mono); overflow-wrap: anywhere; }
.timer-list { display: grid; gap: 10px; }
.timer-item { padding: 13px; display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.timer-item strong { font-size: 12px; }
.timer-item time { grid-row: span 2; font: 500 23px var(--mono); color: var(--primary); }
.timer-item span { color: var(--text-3); font-size: 9px; }
.timer-item.done { border-color: var(--accent); animation: pulse-border 1s ease-in-out infinite alternate; }
@keyframes pulse-border { to { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); } }

.info-dialog { width: min(620px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 19px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.info-dialog > div { padding: 28px; position: relative; }
.info-dialog h2 { margin: 0 40px 18px 0; }
.info-dialog p, .info-dialog li { color: var(--text-2); font-size: 12px; line-height: 1.7; }
.close-info { position: absolute; top: 16px; right: 16px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 30px); padding: 11px 16px; border-radius: 10px; color: var(--surface); background: var(--text); box-shadow: var(--shadow-sm); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 2px; }

@media (max-width: 1040px) {
  .site-header { grid-template-columns: 220px 1fr auto; }
  .hero { grid-template-columns: 1fr .65fr; gap: 45px; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-body { grid-template-columns: 1fr 390px; }
}

@media (max-width: 820px) {
  .site-header { grid-template-columns: 1fr auto; padding-inline: 18px; }
  .header-search { display: none; }
  .hero { padding-top: 64px; grid-template-columns: 1fr; }
  .hero-panel { max-width: 520px; transform: none; }
  .trust-strip { grid-template-columns: repeat(2, 1fr); }
  .trust-strip div:nth-child(2) { border-right: 0; }
  .trust-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .tools-section { grid-template-columns: 1fr; }
  .tool-sidebar { position: static; }
  #category-list { display: flex; overflow: auto; padding-bottom: 5px; }
  .category-button { width: auto; flex: 0 0 auto; }
  .category-button small { display: none; }
  .sidebar-note { display: none; }
  .brand-bridge { grid-template-columns: 1fr; }
  .bridge-actions { grid-column: auto; }
  footer { grid-template-columns: 1fr; }
  .dialog-body { grid-template-columns: 1fr; overflow: auto; }
  .calculator-pane, .result-pane { overflow: visible; }
  .result-pane { border-left: 0; border-top: 1px solid var(--line); }
  .result-placeholder { min-height: 240px; }
}

@media (max-width: 560px) {
  .site-header { height: 68px; }
  .brand-mark { width: 34px; height: 34px; }
  .site-beta-badge { padding: 3px 5px; font-size: 7px; }
  #favorites-button, #theme-button { display: none; }
  .hero { min-height: auto; padding: 52px 18px 62px; }
  .hero h1 { font-size: clamp(42px, 13vw, 60px); }
  .hero-search { padding-left: 14px; }
  .hero-search button { padding: 0 13px; }
  .popular-links span { width: 100%; }
  .hero-panel { padding: 20px; }
  .trust-strip { margin-inline: 18px; }
  .trust-strip div { min-height: 80px; flex-direction: column; gap: 3px; text-align: center; }
  .trust-strip span { max-width: none; }
  .tools-section { padding: 62px 18px 80px; }
  .content-heading { align-items: start; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 180px; }
  .brand-bridge { margin-inline: 18px; }
  .bridge-actions { flex-direction: column; }
  .bridge-actions a { justify-content: center; }
  footer { padding-inline: 18px; }
  .tool-dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .dialog-header { min-height: 88px; padding: 14px; }
  .dialog-identity > .tool-icon { display: none; }
  .dialog-identity > div > span { max-width: 230px; }
  .dialog-body { min-height: 0; }
  .calculator-pane, .result-pane { padding: 18px 14px; }
  .dialog-footer { padding: 10px 14px; }
  .dialog-footer span { max-width: 210px; }
  .field-grid, .field-grid.three, .plate-controls, .map-controls { grid-template-columns: 1fr; }
  .print-labels { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; inset: 0; width: 100%; padding: 10mm; }
  .print-labels { grid-template-columns: repeat(4, 1fr); }
  .print-label { border: 1px solid #777; break-inside: avoid; }
}

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

/* Prevent horizontally scrollable category chips from widening the mobile grid. */
.tool-sidebar, .tool-content { min-width: 0; }
@media (max-width: 820px) {
  #category-list { width: 100%; max-width: 100%; }
}
.card-open-button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 0; border: 0; background: transparent; color: var(--primary); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; cursor: pointer; }
.card-open-button svg { width: 13px; }
.card-open-button:hover { color: var(--primary-2); }

/* Phase 2 workflows */
.footer-actions { display: flex; gap: 8px; }
.protocol-print-header { display: none; }
.workflow-plate { display: grid; gap: 3px; min-width: max-content; padding: 8px; }
.workflow-well { min-width: 43px; min-height: 43px; padding: 4px; display: grid; align-content: center; justify-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text-2); font: 8px var(--mono); overflow: hidden; }
.workflow-well b { max-width: 64px; font-size: 7px; font-weight: 650; text-align: center; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.workflow-well.sample { background: color-mix(in srgb, var(--accent) 13%, var(--surface)); }
.workflow-well.ntc { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); background: color-mix(in srgb, var(--warning) 11%, var(--surface)); }
.workflow-well.positive { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); background: var(--primary-soft); }
.workflow-well.compact { min-width: 26px; min-height: 30px; padding: 2px; font-size: 6px; }
.workflow-well.compact b { display: none; }
.curve-chart { padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.curve-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.curve-chart .chart-axis { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.curve-chart .chart-fit { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.curve-chart circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.heat-legend { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; color: var(--text-3); font: 9px var(--mono); }
.heat-legend i { height: 9px; border-radius: 999px; background: linear-gradient(90deg,hsl(205 72% 84%),hsl(117 72% 67%),hsl(30 72% 49%)); }
.inline-actions { justify-content: flex-start; margin-top: -3px; }
.status-message { padding: 10px 12px; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-size: 10px; }
.inline-link { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.wrap-code { display: inline-block; max-width: 240px; white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  .dialog-footer { align-items: flex-start; }
  .dialog-footer > span { display: none; }
  .footer-actions { width: 100%; }
  .footer-actions button { flex: 1; }
}

@media print {
  body.protocol-print-mode { background: white !important; }
  body.protocol-print-mode * { visibility: hidden !important; }
  body.protocol-print-mode #tool-dialog,
  body.protocol-print-mode #tool-dialog .dialog-shell,
  body.protocol-print-mode #tool-dialog .dialog-header,
  body.protocol-print-mode #tool-dialog .dialog-header *,
  body.protocol-print-mode #tool-dialog .result-pane,
  body.protocol-print-mode #tool-dialog .result-pane *,
  body.protocol-print-mode #tool-dialog .dialog-footer,
  body.protocol-print-mode #tool-dialog .dialog-footer > span,
  body.protocol-print-mode #tool-dialog .dialog-footer > span * { visibility: visible !important; }
  body.protocol-print-mode #tool-dialog { display: block; position: static; width: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: white; }
  body.protocol-print-mode .dialog-shell { display: block; min-height: 0; background: white; box-shadow: none; }
  body.protocol-print-mode .dialog-header { padding: 0 0 5mm; border-bottom: 1px solid #cbd5d2; }
  body.protocol-print-mode .dialog-header .dialog-actions,
  body.protocol-print-mode .dialog-header .tool-icon,
  body.protocol-print-mode .dialog-body .calculator-pane,
  body.protocol-print-mode .footer-actions { display: none !important; }
  body.protocol-print-mode .dialog-body { display: block; min-height: 0; }
  body.protocol-print-mode .result-pane { padding: 6mm 0; border: 0; background: white; overflow: visible; }
  body.protocol-print-mode .protocol-print-header { display: block; margin-bottom: 6mm; color: #132522; }
  body.protocol-print-mode .protocol-print-header b { color: #0b6b60; font-size: 9pt; letter-spacing: .08em; text-transform: uppercase; }
  body.protocol-print-mode .protocol-print-header h1 { margin: 2mm 0 1mm; font-size: 20pt; }
  body.protocol-print-mode .protocol-print-header p,
  body.protocol-print-mode .protocol-print-header small { color: #536a66; font-size: 9pt; }
  body.protocol-print-mode .result-card { color: #132522; }
  body.protocol-print-mode .dialog-footer { min-height: 0; padding: 4mm 0 0; border-top: 1px solid #cbd5d2; color: #536a66; }
  body.protocol-print-mode .result-table-wrap,
  body.protocol-print-mode .protocol-block,
  body.protocol-print-mode .warning-block,
  body.protocol-print-mode .curve-chart { break-inside: avoid; }
  body.protocol-print-mode .map-scroll { overflow: visible; transform-origin: top left; }
  body.protocol-print-mode .workflow-plate { min-width: 0; }
}

/* Phase 2.5 Lab Agent */
.agent-header-button { min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line)); border-radius: 999px; color: var(--primary); background: var(--primary-soft); font: 700 10px var(--sans); cursor: pointer; }
.agent-header-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.agent-header-button:hover { border-color: var(--primary); transform: translateY(-1px); }
.agent-backdrop { position: fixed; z-index: 78; inset: 0; background: color-mix(in srgb, #071916 38%, transparent); backdrop-filter: blur(2px); }
.agent-drawer { position: fixed; z-index: 79; top: 0; right: 0; width: min(460px, 100vw); height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; color: var(--text); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -24px 0 70px rgba(9, 37, 33, .18); }
.agent-drawer[hidden], .agent-backdrop[hidden] { display: none; }
body.agent-open { overflow: hidden; }
.agent-drawer-header { min-height: 76px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, var(--primary-soft)); }
.agent-drawer-header h2 { margin: 3px 0 0; font-size: 19px; }
.agent-beta { color: var(--primary); font: 700 8px var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.agent-drawer-body { min-height: 0; padding: 18px; overflow-y: auto; }
.agent-intro { padding: 15px; border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line)); border-radius: 13px; background: var(--primary-soft); }
.agent-intro p { margin: 0 0 8px; color: var(--text); font-size: 11px; line-height: 1.65; }
.agent-intro small, .agent-disclaimer { display: block; color: var(--text-3); font-size: 8px; line-height: 1.55; }
.agent-quick { margin-top: 19px; }
.agent-quick h3 { margin: 0 0 9px; color: var(--text-3); font: 700 9px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
#agent-workflows { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.agent-workflow { min-height: 86px; padding: 11px; display: grid; align-content: start; gap: 5px; text-align: left; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--surface-raised); cursor: pointer; }
.agent-workflow:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.agent-workflow strong { font-size: 10px; }
.agent-workflow span { color: var(--text-3); font-size: 8px; line-height: 1.5; }
.agent-messages { display: grid; gap: 11px; margin-top: 20px; }
.agent-message { max-width: 92%; padding: 12px 13px; border-radius: 13px 13px 13px 4px; border: 1px solid var(--line); background: var(--surface-raised); }
.agent-message.user { justify-self: end; border-color: color-mix(in srgb, var(--primary) 28%, var(--line)); border-radius: 13px 13px 4px 13px; background: var(--primary-soft); }
.agent-message.loading { opacity: .7; animation: agent-pulse 1s ease-in-out infinite alternate; }
@keyframes agent-pulse { to { opacity: .4; } }
.agent-message-label { display: block; margin-bottom: 5px; color: var(--primary); font: 700 8px var(--mono); text-transform: uppercase; }
.agent-message p { margin: 0; color: var(--text-2); font-size: 10px; line-height: 1.65; white-space: pre-wrap; }
.agent-detail { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.agent-detail strong { color: var(--text); font-size: 9px; }
.agent-detail ul { margin: 6px 0 0; padding-left: 17px; color: var(--text-2); font-size: 8px; line-height: 1.65; }
.agent-detail li.ok { color: var(--primary); }
.agent-detail li.error { color: var(--warning); }
.agent-message-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.agent-secondary { min-height: 31px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--primary); background: var(--surface); font-size: 8px; font-weight: 700; cursor: pointer; }
.agent-secondary:hover { border-color: var(--primary); }
.agent-form { padding: 13px 16px 15px; display: grid; gap: 8px; border-top: 1px solid var(--line); background: var(--surface); }
.agent-profile-option { display: flex; align-items: center; gap: 7px; color: var(--text-3); font-size: 8px; line-height: 1.4; cursor: pointer; }
.agent-profile-option input { accent-color: var(--primary); }
.agent-form textarea { width: 100%; min-height: 88px; resize: vertical; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 11px; color: var(--text); background: var(--surface-raised); font: 10px/1.55 var(--sans); }
.agent-form textarea:focus { border-color: var(--primary); }
.agent-form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.agent-form-row small { max-width: 250px; color: var(--text-3); font: 7px/1.4 var(--mono); overflow-wrap: anywhere; }
.agent-form-row button { min-height: 38px; padding: 0 16px; border: 0; border-radius: 9px; color: white; background: var(--primary); font-size: 9px; font-weight: 800; cursor: pointer; }
.agent-form-row button:disabled { opacity: .55; cursor: wait; }

@media (max-width: 720px) {
  .agent-header-button { width: 38px; padding: 0; justify-content: center; }
  .agent-header-button span { display: none; }
}
@media (max-width: 480px) {
  .agent-drawer { width: 100vw; border-left: 0; }
  .agent-drawer-header { min-height: 68px; padding: 12px 14px; }
  .agent-drawer-body { padding: 14px; }
  #agent-workflows { grid-template-columns: 1fr; }
  .agent-workflow { min-height: 70px; }
  .agent-form { padding: 10px 12px 12px; }
}
.agent-register-link { display: inline-flex; margin-top: 8px; padding: 8px 11px; border-radius: 9px; color: #fff; background: var(--primary); font-size: 12px; font-weight: 750; text-decoration: none; }
.agent-register-link:hover { background: var(--primary-2); }
