:root {
  --ink:#17202a;
  --muted:#69727d;
  --line:#dce2e8;
  --accent:#176b87;
  --surface:#fff;
  font-family:Inter,Arial,sans-serif;
  color:var(--ink);
  background:#f4f6f8;
}
* { box-sizing:border-box; }
body { margin:0; }
a { color:var(--accent); }
.topbar {
  min-height:64px;
  padding:0 5vw;
  display:flex;
  align-items:center;
  justify-content:space-between;
  color:white;
  background:#17202a;
}
.topbar a { color:white; text-decoration:none; }
.brand { font-weight:800; letter-spacing:.01em; }
.topbar nav { display:flex; align-items:center; gap:8px; }
.topbar nav a {
  padding:8px 11px;
  border:1px solid transparent;
  border-radius:999px;
  color:#dfe8ec;
}
.topbar nav a:hover { border-color:#46616a; background:#24313c; }
.topbar nav a.active {
  color:#17202a;
  background:#ffffff;
  box-shadow:0 8px 24px #00000024;
}
.topbar form { margin:0; }
.link-button { padding:0; border:0; color:white; background:none; cursor:pointer; }
.page { width:min(1180px,92vw); margin:38px auto 70px; }
.hero { min-height:70vh; display:grid; grid-template-columns:1.45fr .75fr; align-items:center; gap:60px; }
.hero h1 { max-width:760px; margin:10px 0 16px; font-size:clamp(42px,6vw,72px); line-height:1.02; }
.hero p { max-width:650px; color:var(--muted); font-size:19px; line-height:1.55; }
.eyebrow { color:var(--accent); font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:.12em; }
.feature-card,.panel,.auth-card,.project-card,.empty-state {
  padding:24px;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--surface);
  box-shadow:0 8px 30px #17202a0a;
}
.feature-card ul { padding-left:19px; line-height:2; }
.hero-actions,.result-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:26px; }
.button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 15px;
  border:1px solid var(--line);
  border-radius:9px;
  color:var(--ink);
  background:white;
  text-decoration:none;
  cursor:pointer;
  font-weight:700;
}
.button.primary { color:white; border-color:var(--accent); background:var(--accent); }
.button:disabled { opacity:.45; cursor:not-allowed; }
.auth-card { width:min(480px,100%); margin:8vh auto; }
.stack { display:grid; gap:14px; }
label { display:grid; gap:6px; font-size:14px; font-weight:700; }
input,textarea,select {
  width:100%;
  padding:11px;
  border:1px solid var(--line);
  border-radius:9px;
  background:white;
  font:inherit;
}
.compact-panel { padding:14px 18px; }
.compact-panel .section-heading { margin-bottom:10px; }
.chip-row { display:flex; flex-wrap:wrap; gap:8px; }
.metric-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.metric-grid.four { grid-template-columns:repeat(4,1fr); }
.metric strong { display:block; margin-top:8px; font-size:34px; }
.metric span { color:var(--muted); }
.admin-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.admin-list { display:grid; }
.admin-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:13px 0;
  border-bottom:1px solid var(--line);
}
.admin-row small,.file-list small { display:block; margin-top:4px; color:var(--muted); }
.inline-form { display:flex; align-items:center; gap:8px; }
.admin-form { margin-top:24px; padding-top:20px; border-top:1px solid var(--line); }
.admin-form h3 { margin:0; }
.audit-list > div {
  display:grid;
  grid-template-columns:1.2fr 1fr auto;
  gap:14px;
  padding:10px 0;
  border-bottom:1px solid var(--line);
}
.audit-list span,.audit-list time { color:var(--muted); }
.reference-admin-grid { display:grid; grid-template-columns:1fr 1fr; gap:28px; }
.inline-create { margin-top:18px; }
.inline-create form {
  position:static;
  width:auto;
  margin-top:10px;
  box-shadow:none;
}
.lab-inputs { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.report-information-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.form-footer { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.scoring-create form { width:min(850px,85vw); }
.scoring-head { display:grid; grid-template-columns:2fr 1fr; gap:10px; }
.scoring-table-wrap { overflow:auto; }
.scoring-table { width:100%; border-collapse:collapse; }
.scoring-table th,.scoring-table td { padding:7px; border-bottom:1px solid var(--line); text-align:left; }
.scoring-table input { min-width:95px; padding:8px; }
.grade-inputs { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; }
.scoring-model-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:12px; }
.scoring-model-card { padding:16px; border:1px solid var(--line); border-radius:12px; background:#f8fafb; }
.scoring-model-card h3 { margin:9px 0 5px; }
.scoring-model-card h3 small { color:var(--muted); }
.scoring-model-card p { min-height:38px; color:var(--muted); }
.scoring-summary { display:flex; flex-wrap:wrap; gap:6px; margin:12px 0; }
.scoring-summary span { padding:5px 7px; border-radius:6px; background:#e5eef1; font-size:11px; }
.check-label { display:flex; align-items:flex-start; grid-template-columns:auto 1fr; }
.check-label input { width:auto; margin-top:2px; }
.link-danger { border:0; color:#8c2424; background:none; cursor:pointer; }
.notice { margin:14px 0; padding:11px; border-radius:8px; }
.notice.error,.file-error { color:#8c2424; background:#fff1f1; }
.subtle,.page-heading p { color:var(--muted); }
.page-heading,.section-heading,.result-panel {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin-bottom:24px;
}
.page-heading h1 { margin:6px 0; font-size:38px; }
.project-nav {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin:-4px 0 22px;
}
.project-nav-sticky {
  position:sticky;
  top:8px;
  z-index:4;
  padding:8px;
  border:1px solid #dce8ed;
  border-radius:18px;
  background:#f4f6f8e8;
  backdrop-filter:blur(10px);
}
.project-nav a {
  position:relative;
  display:grid;
  gap:4px;
  min-height:82px;
  padding:16px 16px 14px;
  border:2px solid #d4e0e6;
  border-radius:15px;
  color:var(--ink);
  background:linear-gradient(180deg,#ffffff 0%,#f8fafb 100%);
  text-decoration:none;
  box-shadow:0 10px 28px #17202a0d;
  overflow:hidden;
}
.project-nav a:hover { border-color:#9cb9c3; transform:translateY(-1px); }
.project-nav a.active {
  border-color:var(--accent);
  background:linear-gradient(135deg,#e9f8fb 0%,#ffffff 65%);
  box-shadow:0 15px 34px #176b8720;
}
.project-nav a.active::before {
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:7px;
  background:var(--accent);
}
.project-nav strong { font-size:17px; }
.project-nav span { color:var(--muted); font-size:12px; line-height:1.35; }
.create-panel { position:relative; }
.create-panel summary { list-style:none; }
.create-panel form {
  position:absolute;
  z-index:5;
  right:0;
  width:360px;
  margin-top:8px;
  padding:18px;
  border:1px solid var(--line);
  border-radius:12px;
  background:white;
  box-shadow:0 16px 50px #17202a22;
}
.project-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(270px,1fr)); gap:16px; }
.settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.settings-card { min-height:260px; }
.row-actions { display:flex; align-items:center; gap:8px; }
.reporting-filter { display:grid; grid-template-columns:1.4fr 1fr auto; gap:12px; align-items:end; }
.project-card { color:var(--ink); text-decoration:none; }
.project-card:hover { border-color:var(--accent); transform:translateY(-1px); }
.project-card h2 { margin:12px 0 5px; }
.status {
  display:inline-flex;
  padding:4px 8px;
  border-radius:999px;
  color:#52606b;
  background:#edf1f4;
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
}
.status.ready,.status.analyzed { color:#12613d; background:#e0f4e9; }
.status.reference { color:#176b87; background:#e2f1f6; }
.status.unsupported { color:#8c4f24; background:#fff0d9; }
.status.failed { color:#8c2424; background:#ffe3e3; }
.status.processing { color:#835c00; background:#fff0c4; }
.status.large { padding:7px 11px; }
.workflow-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
.panel { margin-bottom:16px; }
.step { float:right; display:grid; place-items:center; width:34px; height:34px; border-radius:50%; color:white; background:var(--accent); font-weight:800; }
.dropzone { padding:26px; border:2px dashed #b9c9d0; border-radius:12px; text-align:center; cursor:pointer; }
.dropzone span { color:var(--muted); font-weight:400; }
.dropzone input { margin-top:10px; padding:0; border:0; }
.upload-selection { display:grid; gap:6px; }
.upload-selection > span { display:flex; justify-content:space-between; gap:12px; padding:8px 10px; border-radius:8px; background:#eef5f7; font-size:13px; }
.upload-selection small { color:var(--muted); white-space:nowrap; }
.analysis-panel { display:flex; min-height:100%; flex-direction:column; }
.analysis-file-list { display:grid; max-height:300px; overflow:auto; margin:8px 0 14px; border:1px solid var(--line); border-radius:11px; }
.analysis-file-row { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:11px 12px; border-bottom:1px solid var(--line); background:#fff; }
.analysis-file-row:last-child { border-bottom:0; }
.analysis-file-main { display:flex; min-width:0; align-items:center; gap:10px; }
.analysis-file-main > span:last-child { min-width:0; }
.analysis-file-main strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.analysis-file-main small { display:block; margin-top:3px; color:var(--muted); }
.import-preview { display:block; margin-top:5px; color:#3e6570; font-size:11px; line-height:1.35; }
.import-preview.unsupported { color:#9b4c31; }
.import-profile-name { color:#55727b !important; }
.analysis-file-icon { display:grid; width:34px; height:34px; flex:0 0 auto; place-items:center; border-radius:9px; color:var(--accent); background:#e8f3f6; font-size:18px; }
.analysis-file-actions { display:flex; flex:0 0 auto; align-items:center; gap:8px; }
.text-button { padding:3px 0; border:0; color:var(--accent); background:transparent; font:inherit; font-size:12px; font-weight:800; cursor:pointer; }
.text-button.danger { color:#a13a3a; }
.text-button:hover { text-decoration:underline; }
.analysis-empty { display:grid; gap:4px; margin:12px 0 18px; padding:18px; border:1px dashed #b9c9d0; border-radius:11px; color:var(--muted); text-align:center; }
.analysis-empty strong { color:var(--ink); }
.analysis-progress { margin:5px 0 15px; padding:13px; border-radius:10px; background:#f0f7f8; }
.analysis-progress > small { display:block; overflow:hidden; margin-top:8px; color:var(--muted); text-overflow:ellipsis; white-space:nowrap; }
.analysis-submit { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:auto; }
.analysis-submit > span { color:var(--muted); font-size:12px; font-weight:700; }
.file-list > div { display:flex; justify-content:space-between; gap:15px; padding:10px 0; border-bottom:1px solid var(--line); }
.report-menu {
  position:absolute;
  right:0;
  min-width:300px;
  max-height:340px;
  overflow:auto;
  padding:8px;
  border:1px solid var(--line);
  border-radius:10px;
  background:white;
  box-shadow:0 14px 40px #17202a25;
}
.result-actions details { position:relative; }
.result-actions summary { list-style:none; }
.report-menu a { display:block; padding:8px; text-decoration:none; border-radius:6px; }
.report-menu a:hover { background:#eef5f7; }
.back-link { text-decoration:none; }
.live-workflow-panel { border-color:#b9d3dc; background:linear-gradient(135deg,#fff 0%,#f4fafb 100%); }
.measurement-template-create form {
  position:fixed;
  top:78px;
  right:5vw;
  width:min(580px,90vw);
  max-height:calc(100vh - 100px);
  overflow:auto;
}
fieldset { padding:12px; border:1px solid var(--line); border-radius:10px; }
legend { padding:0 5px; font-size:13px; font-weight:800; }
.channel-checks { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.template-picker-heading { display:flex; align-items:end; justify-content:space-between; gap:16px; margin-bottom:10px; }
.template-picker-heading strong { display:block; font-size:17px; }
.template-picker-heading span { color:var(--muted); font-size:13px; }
.template-picker { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:10px; }
.template-choice { position:relative; min-height:132px; padding:15px; border:1px solid var(--line); border-radius:12px; color:var(--ink); background:#fff; text-align:left; cursor:pointer; transition:border-color .15s,box-shadow .15s,transform .15s; }
.template-choice:hover { border-color:#8fb9c5; transform:translateY(-1px); }
.template-choice.selected { border:2px solid var(--accent); padding:14px; box-shadow:0 8px 22px #1f778b18; background:#f8fcfd; }
.template-choice > strong,.template-choice > small { display:block; padding-right:22px; }
.template-choice > small { min-height:34px; margin-top:5px; color:var(--muted); line-height:1.35; }
.template-choice-check { position:absolute; top:12px; right:12px; display:none; width:22px; height:22px; place-items:center; border-radius:50%; color:#fff; background:var(--accent); font-size:13px; font-weight:900; }
.template-choice.selected .template-choice-check { display:grid; }
.template-choice-meta { display:flex; flex-wrap:wrap; gap:5px; margin-top:12px; }
.template-choice-meta span { padding:4px 7px; border-radius:999px; color:#46616a; background:#edf4f6; font-size:11px; font-weight:800; }
.measurement-start-form { display:grid; grid-template-columns:minmax(240px,1.5fr) minmax(150px,.8fr) auto; align-items:end; gap:10px; margin-top:14px; padding:14px; border:1px solid #cbdde2; border-radius:12px; background:#fff; }
.measurement-start-selection { display:grid; gap:4px; align-self:center; padding:0 4px; }
.measurement-start-selection span { color:var(--muted); font-size:12px; }
.measurement-start-button { min-height:42px; }
.measurement-start-options { grid-column:1/-1; border-top:1px solid var(--line); padding-top:10px; }
.measurement-start-options summary,.measurement-template-management > summary { width:max-content; color:var(--accent); font-size:13px; font-weight:800; cursor:pointer; }
.measurement-start-options-grid { display:grid; grid-template-columns:repeat(3,minmax(160px,1fr)); gap:10px; margin-top:10px; }
.wedge-editor { padding:12px; border:1px solid var(--line); border-radius:10px; background:#f8fafb; }
.wedge-editor-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
[data-role="wedge-rows"] { display:grid; gap:7px; }
.wedge-row { display:grid; grid-template-columns:22px 1.1fr 1.1fr 1.1fr 64px 30px 30px 30px; align-items:center; gap:5px; }
.wedge-row input { min-width:0; padding:8px; }
.wedge-row button { height:34px; padding:0; border:1px solid var(--line); border-radius:7px; background:white; cursor:pointer; }
.wedge-row.dragging { opacity:.45; }
.wedge-handle { color:var(--muted); text-align:center; cursor:grab; }
.measurement-template-management { margin-top:14px; padding-top:2px; }
.measurement-template-management > p { margin:9px 0 0; }
.measurement-template-list { display:grid; gap:8px; margin-top:10px; }
.template-edit-panel { border:1px solid var(--line); border-radius:9px; background:#fff; }
.template-edit-panel summary { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:10px 12px; cursor:pointer; }
.template-edit-panel summary small { display:block; margin-top:3px; color:var(--muted); }
.template-edit-panel summary > span:last-child { color:var(--accent); font-size:13px; font-weight:800; white-space:nowrap; }
.template-edit-panel form { padding:14px; border-top:1px solid var(--line); }
.template-variant-form { background:#f8fafb; }
.template-variant-heading small { display:block; margin-top:3px; color:var(--muted); }
.template-variant-grid { display:grid; grid-template-columns:1.2fr 1fr 1fr auto; align-items:end; gap:10px; }
.empty-inline { display:flex; align-items:center; gap:10px; padding:16px; border-radius:10px; background:#eef5f7; }
.empty-inline span { color:var(--muted); }
.setting-chip { padding:8px 11px; border-radius:999px; color:#46616a; background:#edf4f6; font-size:12px; font-weight:800; }
.measurement-session-list { display:grid; gap:8px; margin-top:18px; padding-top:16px; border-top:1px solid var(--line); }
.measurement-session-list a { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; border-radius:9px; color:var(--ink); background:white; text-decoration:none; }
.measurement-session-list small,.patch-table small { display:block; margin-top:3px; color:var(--muted); }
.measurement-heading .eyebrow { display:block; margin-top:18px; }
.measurement-progress-panel { padding:14px 18px; }
.progress-copy { display:flex; justify-content:space-between; margin-bottom:9px; }
.progress-copy span { color:var(--muted); }
.progress-track { height:9px; overflow:hidden; border-radius:999px; background:#e3e8ec; }
.progress-track span { display:block; height:100%; border-radius:inherit; background:var(--accent); transition:width .2s ease; }
.measurement-capture { display:grid; grid-template-columns:.9fr 1.1fr; gap:16px; }
.device-panel {
  display:grid;
  grid-template-columns:1fr auto;
  gap:12px;
  margin-bottom:18px;
  padding:14px;
  border:1px solid #c7dce4;
  border-radius:12px;
  background:linear-gradient(135deg,#f4fbfd 0%,#ffffff 100%);
}
.device-panel strong { display:block; margin:4px 0; }
.device-actions { display:grid; align-content:start; gap:8px; min-width:180px; }
.device-auto-submit { font-size:12px; font-weight:700; }
.device-paste { grid-column:1/-1; }
.device-raw-capture textarea {
  min-height:74px;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;
  font-size:13px;
  background:#fffdf5;
}
.device-raw-capture textarea:focus {
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(26,121,148,.14);
  outline:0;
}
.current-patch-card h2 { margin:7px 0 16px; font-size:30px; }
.patch-preview { min-height:180px; display:grid; place-items:center; padding:20px; border:1px solid var(--line); border-radius:12px; background:linear-gradient(145deg,#f8fafb,#e5eef1); text-align:center; }
.patch-preview strong { font-size:18px; }
.patch-solid { background:linear-gradient(145deg,#eaf4f7,#d4e8ee); }
.patch-paper { background:linear-gradient(145deg,#fff,#f1f1ed); }
.patch-meta { display:grid; grid-template-columns:auto 1fr; gap:7px 15px; margin:18px 0 0; }
.patch-meta dt { color:var(--muted); }
.patch-meta dd { margin:0; font-weight:700; }
.large-lab-inputs { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.large-lab-inputs input { padding:16px 12px; font-size:22px; font-weight:700; }
.capture-button { min-height:50px; }
.patch-table-wrap { overflow:auto; }
.patch-table { width:100%; border-collapse:collapse; }
.patch-table th,.patch-table td { padding:10px; border-bottom:1px solid var(--line); text-align:left; white-space:nowrap; }
.patch-table tr.current { background:#eef7fa; }
.patch-table tr.measured { background:#fbfdfc; }
@media (max-width:760px) {
  .hero,.workflow-grid,.metric-grid,.metric-grid.four,.admin-grid,.reference-admin-grid,.scoring-head,.grade-inputs,.report-information-grid,.measurement-start-form,.measurement-start-options-grid,.template-variant-grid,.measurement-capture,.project-nav,.settings-grid,.reporting-filter,.device-panel { grid-template-columns:1fr; }
  .hero { gap:24px; }
  .page-heading,.result-panel { align-items:flex-start; flex-direction:column; }
  .create-panel form { position:fixed; inset:80px 4vw auto; width:auto; }
  .topbar nav > span { display:none; }
  .admin-row,.inline-form { align-items:stretch; flex-direction:column; }
  .form-footer { align-items:stretch; flex-direction:column; }
  .audit-list > div { grid-template-columns:1fr; gap:4px; }
  .channel-checks { grid-template-columns:repeat(2,1fr); }
  .measurement-start-options { grid-column:auto; }
  .analysis-file-row,.analysis-submit { align-items:stretch; flex-direction:column; }
  .analysis-file-actions { justify-content:space-between; }
}
