.eyebrow { font-size: 11px; }
.topbar { padding: 10px 20px; gap: 16px; }
.topbar > div:first-child { min-width: 340px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(145deg,#188fd0,#08788f); color: #fff; font: italic 700 28px/1 Georgia,serif; box-shadow: 0 8px 24px rgba(31,170,218,.2); }
.topbar h1 { font-size: 21px; }
.topbar .eyebrow { margin-bottom: 3px; }
.topbar p { margin-top: 3px; }
.toolbar { gap: 6px; justify-content: flex-end; }
.toolbar .button { padding: 7px 10px; }
.toolbar .help-link { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.help-menu { position: relative; }
.help-dropdown { position: absolute; right: 0; top: calc(100% + 7px); z-index: 80; width: 230px; padding: 7px; border: 1px solid var(--line); border-radius: 11px; background: #f8fbfd; box-shadow: 0 16px 35px rgba(0,0,0,.32); }
.help-dropdown[hidden] { display: none; }
.help-dropdown button,.help-dropdown a { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: #263746; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.help-dropdown button:hover,.help-dropdown a:hover { background: #eaf2f7; }
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,11,17,.72); backdrop-filter: blur(5px); }
.about-dialog { position: relative; z-index: 1; width: min(620px,100%); max-height: calc(100vh - 36px); overflow: auto; padding: 28px; border-radius: 18px; background: #f9fbfd; color: #263746; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.about-dialog h2 { margin: 18px 0 4px; color: #137fba; font-size: 25px; }
.about-dialog p,.about-dialog li { font-size: 13px; line-height: 1.55; }
.about-dialog ul { padding-left: 22px; }
.about-subtitle { color: #66788b; margin-bottom: 18px !important; }
.about-mark { width: 58px; height: 58px; font-size: 35px; }
.modal-close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eaf0f4; color: #263746; font-size: 25px; cursor: pointer; }
.about-divider { height: 1px; margin: 22px 0 16px; background: #d4dee6; }
.about-organization { display: grid; grid-template-columns: 92px 1fr; gap: 16px; align-items: center; }
.about-organization p { margin: 2px 0; color: #52677a; font-size: 11px; }
.about-organization a { color: #137fba; text-decoration: none; font-weight: 700; }
.university-emblem { display: block; width: 92px; height: auto; }
body.modal-open { overflow: hidden; }
.library-dialog { width: min(680px,100%); }
.library-dialog h2 { margin-top: 0; padding-right: 42px; }
.library-dialog select { width: 100%; min-height: 39px; }
.library-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.button.danger { border-color: #c75353; background: #fff3f3; color: #a52f2f; }
.button.danger:hover { background: #ffe3e3; }
.login-box { display: flex; align-items: center; gap: 6px; }
.login-box[hidden] { display: none; }
.login-box input { width: 112px; padding: 7px 8px; }
.login-box span { color: var(--accent2); font-size: 11px; font-weight: 700; }
.site-footer { padding: 15px 22px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; text-align: center; }
.site-footer a { color: var(--accent); text-decoration: none; background-image: none !important; }
.site-footer a::before, .site-footer a::after, .site-footer a img { content: none !important; display: none !important; }
.site-footer a:hover { text-decoration: underline; }
.optimization-card {
  padding: 16px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(21,31,43,.96), rgba(15,24,34,.96));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.optimization-card[hidden],#optimizeBtn[hidden] { display:none !important; }
.optimization-head { margin: 0 0 16px; }
.optimization-layout {
  display: grid;
  grid-template-columns: minmax(0,1.7fr) minmax(250px,.8fr);
  gap: 22px;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(150px,1fr));
  gap: 7px;
}
.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #cbd6e1;
  font-size: 12px;
  cursor: pointer;
}
.check-field input { width: auto; accent-color: var(--accent); }
.optimization-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 1px solid var(--line);
  padding-left: 20px;
}
.criteria-list { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 11px; }
.criteria-list b { color: #cbd6e1; font-weight: 650; }
.criteria-list b::before { content: '✓'; color: var(--accent2); margin-right: 7px; }
@media(max-width:900px) {
  .topbar { align-items: flex-start; }
  .toolbar { justify-content: flex-start; }
  .optimization-layout { grid-template-columns: 1fr; }
  .optimization-settings { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .check-grid { grid-template-columns: repeat(2,minmax(140px,1fr)); }
}
@media(max-width:520px) { .check-grid { grid-template-columns: 1fr; } }
@media(max-width:620px) { .about-dialog { padding: 22px; } .about-organization { grid-template-columns: 1fr; } }

/* Светлая тема PANTOGRAPH CORE */
:root { --bg:#eef3f6; --panel:#ffffff; --panel2:#f7fafc; --line:#ccd8e1; --text:#203241; --muted:#667b8c; --accent:#1688bd; --accent2:#69a43d; --danger:#c44d55; --shadow:0 10px 28px rgba(44,72,92,.10); }
body { background:linear-gradient(180deg,#f7fafc,#edf3f6 45%,#f5f8fa); color:var(--text); }
.topbar { background:rgba(255,255,255,.94); box-shadow:0 4px 20px rgba(43,72,94,.07); }
.button,select,input { background:#fff; color:var(--text); }
.button.ghost { background:#f7fafc; }
.button:hover { border-color:#7fa6bd; }
.panel,.chart-card,.metric,.note,.mechanism-card,.optimization-card { background:linear-gradient(180deg,#fff,#f9fbfc); }
.check-field { color:#304758; background:#fff; }
.criteria-list b { color:#304758; }
.table-wrap { background:#fff; }
th { background:#eaf1f5; color:#526b7d; }
th,td { border-bottom-color:#dce5eb; }
details { border-top-color:#dce5eb; }
summary { color:#334b5c; }
.progress-wrap { background:#dce6ec; }
.toast { background:#fff; color:var(--text); }
.mechanism-svg .ground { stroke:#9fb0bc; }
.mechanism-svg .axis { stroke:#b7c5cf; }
.mechanism-svg .joint { stroke:#111; }
.mechanism-svg text { fill:#526b7d; }
.mechanism-svg .label-main { fill:#1e3343; }
.guide-grid .wide { grid-column:1/-1; }
.table-panel.wide { grid-row:auto; }
.table-panel.wide .table-wrap { max-height:300px; }
.guide-profile-card { cursor:crosshair; }
.guide-profile-card.dragging { cursor:grabbing; user-select:none; }
.guide-profile-card .scatterlayer .trace:first-child .point { cursor:grab; pointer-events:all; }
.guide-profile-card.dragging .scatterlayer .trace:first-child .point { cursor:grabbing; }
.guide-pressure-tools { margin-top:8px; }
.guide-pressure-tools .hint { margin:0; }
#rkePressureChart.guide-point-hover { cursor:ns-resize; }
#rkePressureChart.guide-pressure-drag, #rkePressureChart.guide-pressure-drag * { cursor:ns-resize; user-select:none; }
.guide-radius-field { max-width: 310px; margin: 0 0 12px; }
.guide-radius-status { margin: -5px 0 12px; }
.guide-radius-status.invalid { color: #b33d3d; font-weight: 700; }

/* Keep the model selector in the same compact row as the header actions. */
.topbar .pantograph-type-field{flex:0 0 130px;min-width:0;gap:0;margin:0}
.topbar .pantograph-type-field>span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.topbar .pantograph-type-field select{width:130px;padding:7px 9px;font-size:12px}
.topbar>.brand{flex:1 1 auto;min-width:0}
.topbar .brand>div:last-child{min-width:0}
.topbar .brand p{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(min-width:1200px){.topbar>.toolbar{flex:0 0 auto;flex-wrap:nowrap}.topbar{gap:12px}}
@media(max-width:720px){.topbar>.brand{flex:none;width:100%;max-width:100%}.topbar>.toolbar{max-width:100%}}
/* Compact sticky header; keep desktop actions on one row. */
.topbar{padding:8px 18px;gap:12px}
.topbar>.brand{min-width:0;flex:1 1 200px;gap:10px}
.topbar .brand-mark{width:38px;height:38px;border-radius:10px;font-size:25px}
.topbar h1{font-size:18px;white-space:nowrap}
.topbar .brand p{font-size:11px;margin-top:2px}
.topbar>.toolbar{gap:6px;min-width:0}
.topbar .button{padding:6px 8px;font-size:12px;white-space:nowrap}
.topbar .pantograph-type-field{flex:0 0 112px;min-width:0}
.topbar .pantograph-type-field select{width:112px;padding:6px 8px}
.topbar .help-menu,.topbar .login-box{flex:0 0 auto}
@media(min-width:1100px){.topbar{flex-wrap:nowrap}.topbar>.toolbar{flex:0 0 auto;flex-wrap:nowrap}}
@media(max-width:1099px){.topbar{flex-wrap:wrap;gap:6px 12px}.topbar>.brand{flex-basis:100%}.topbar>.toolbar{flex:1 1 100%;justify-content:flex-start;flex-wrap:wrap}}
@media(max-width:720px){.topbar{padding:8px 12px}.topbar .brand p{display:none}.topbar .brand-mark{width:30px;height:30px;font-size:22px}.topbar h1{font-size:16px}}
.topbar>div.brand:first-child{min-width:0}
.topbar .brand>div:last-child{overflow:hidden}
.topbar h1{overflow:hidden;text-overflow:ellipsis}
