:root {
  --border: #d6d9dc;
  --muted: #65717a;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --primary: #235f9c;
  --text: #1d252b;
  --sidebar-width: 350px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.5 Arial, "Microsoft YaHei", sans-serif;
}
header {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.brand-block { display: grid; gap: 2px; min-width: 0; }
.brand-line { display: flex; align-items: baseline; gap: 16px; }
header strong { font-size: 18px; letter-spacing: .06em; }
header span { color: var(--muted); }
header a { color: var(--primary); }
.header-links { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 11px; line-height: 1.35; }
main {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: var(--sidebar-width) 10px minmax(0, 1fr);
}
aside {
  overflow: visible;
  padding: 20px;
  border-right: 1px solid var(--border);
  background: var(--panel);
}
.sidebar-toggle {
  position: relative;
  z-index: 2;
  width: 10px;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
  color: #59666f;
  background: #e9edf0;
  cursor: col-resize;
  font-size: 16px;
}
.sidebar-toggle:hover { background: #dce4e9; }
main.sidebar-collapsed {
  --sidebar-width: 0px;
}
main.sidebar-collapsed aside {
  padding: 0;
  overflow: hidden;
  border: 0;
}
main.sidebar-collapsed .sidebar-toggle {
  width: 22px;
  cursor: pointer;
}
aside section { margin: 0 0 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 3px; font-size: 20px; }
h2 { margin-bottom: 10px; font-size: 14px; }
.file-box {
  min-height: 78px;
  display: grid;
  place-items: center;
  padding: 15px;
  border: 1px dashed #9aa4ab;
  background: #fafbfc;
  text-align: center;
  cursor: pointer;
}
.file-box:hover { border-color: var(--primary); }
.file-box.drag-over { border-color: var(--primary); background: #eaf4fc; box-shadow: inset 0 0 0 1px var(--primary); }
.file-box input { position: absolute; opacity: 0; pointer-events: none; }
#file-label { display: block; width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { min-height: 20px; margin: 8px 0 0; color: #a23d30; }
.analysis-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-top: 12px; }
.analysis-controls label { color: var(--muted); font-size: 12px; }
.analysis-controls > button { height: 35px; padding: 0 12px; border: 1px solid var(--primary); color: var(--primary); background: white; cursor: pointer; }
.analysis-controls > button:hover:not(:disabled) { color: white; background: var(--primary); }
.analysis-controls > button:disabled, .run-button:disabled { opacity: .45; cursor: not-allowed; }
.field-help { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.runtime-warning { margin: 0 0 10px; padding: 8px 10px; border-left: 3px solid #b96824; color: #7d4314; background: #fff8ef; font-size: 12px; line-height: 1.45; }
.structure-info { padding: 10px; border: 1px solid var(--border); background: #f8fafb; }
.dimension-control { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.dimension-control select { width: 100%; padding: 8px; border: 1px solid var(--border); color: var(--text); background: white; font: inherit; font-size: 14px; }
.dimension-description { margin: 7px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dimension-badge { display: inline-block; margin: 3px 0 8px; padding: 2px 7px; border: 1px solid #b2c8da; border-radius: 4px; color: #235f9c; background: #edf5fb; font-size: 12px; }
.symmetrize-control { font-size: 12px; }
#layer-policy-controls { margin-top: 10px; }
.analysis-notices { margin-top: 8px; padding: 9px 10px; border-left: 3px solid #b96824; color: #7d4314; background: #fff8ef; font-size: 12px; overflow-wrap: anywhere; }
.analysis-notices p { margin: 0; }
.analysis-notices p + p { margin-top: 6px; }
.analysis-notices.preparation-only { border-left-color: #a9bdcd; color: #536576; background: #f5f8fb; }
.preparation-details summary { cursor: pointer; font-weight: 500; }
.preparation-details p { margin-top: 7px; }
.international-symbol .symbol-space { display: inline-block; width: .16em; }
.international-symbol .symbol-overbar { text-decoration: overline; text-decoration-thickness: 1px; }
#progress-detail { margin: 4px 0 0; }
.group-operations { margin-top: 7px; color: var(--muted); font-size: 12px; }
.orbit-list { display: grid; gap: 6px; }
.orbit {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border);
}
.orbit-description { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.orbit-wyckoff { color: var(--muted); font-size: 12px; white-space: nowrap; }
.orbit-wyckoff.unassigned { color: #9b4f11; }
.magnetic-badge {
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid #b96824;
  color: #9b4f11;
  background: #fff8ef;
  font-size: 11px;
}
.selection-required {
  padding: 9px 10px;
  border-left: 3px solid #b96824;
  color: #7d4314;
  background: #fff8ef;
  font-size: 12px;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-grid label { color: var(--muted); font-size: 12px; }
input[type="number"] {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
}
.check { display: block; margin-top: 10px; }
.run-button, .button-link {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--primary);
  color: white;
  background: var(--primary);
  text-decoration: none;
  cursor: pointer;
}
.run-button { width: 100%; }
.results { min-width: 0; overflow-x: auto; overflow-y: visible; padding: 20px 18px 60px; }
.results-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.results-head p { color: var(--muted); }
.progress { padding: 12px; margin-bottom: 14px; border: 1px solid var(--border); background: var(--panel); }
.progress div { display: flex; justify-content: space-between; margin-bottom: 7px; }
progress { width: 100%; height: 10px; accent-color: var(--primary); }
.empty-state { padding: 55px 20px; color: var(--muted); border: 1px dashed var(--border); background: var(--panel); text-align: center; }
.results-horizontal-scrollbar {
  position:fixed;
  z-index:40;
  bottom:0;
  height:18px;
  overflow-x:auto;
  overflow-y:hidden;
  border-top:1px solid #aebbc5;
  background:#f3f5f6;
  box-shadow:0 -2px 7px rgba(32,49,61,.14);
}
#results-horizontal-scrollbar-content { height:1px; }
.geometry-table {
  min-width: 1460px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.geometry-header,
.geometry summary {
  display: grid;
  grid-template-columns: minmax(270px, 2.3fr) 115px minmax(380px, 2.4fr) 90px 145px 70px 65px minmax(240px, 1.5fr) 72px;
  align-items: stretch;
}
.geometry-header {
  color: #34414a;
  background: #e9edf0;
  font-size: 12px;
  font-weight: 700;
}
.geometry-header span,
.geometry summary > span {
  min-width: 0;
  padding: 8px 9px;
  border-right: 1px solid var(--border);
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}
.geometry-list { display: block; }
.geometry {
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.geometry summary {
  padding: 0;
  cursor: default;
  list-style: none;
}
.geometry summary::-webkit-details-marker { display: none; }
.orientation-toggle-cell { display: grid; place-items: center; }
.orientation-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 48px; padding: 4px 7px; border: 1px solid #9aabb8; border-radius: 5px; color: var(--primary); background: white; cursor: pointer; font-weight: 700; }
.orientation-toggle:hover, .orientation-toggle:focus-visible { border-color: var(--primary); background: #eef6fc; }
.orientation-toggle-icon { display: inline-block; transition: transform .15s ease; }
.geometry[open] .orientation-toggle-icon { transform: rotate(180deg); }
.geometry-name { font-family: Consolas, monospace; font-weight: 600; }
.geometry-name a, .orientation a { color: var(--primary); text-decoration: none; }
.geometry-name a:hover, .orientation a:hover { text-decoration: underline; }
.k-vector {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.tag { color: var(--muted); white-space: nowrap; }
.geometry-body { margin-left: 18px; padding: 6px 10px 10px; border-top: 1px solid var(--border); border-left: 3px solid #aab9c6; background: #fbfcfd; overflow-x: auto; }
.orientations { width: 100%; border-collapse: collapse; font-size: 12px; }
.orientations th, .orientations td { padding: 7px 8px; border: 1px solid var(--border); text-align: left; }
.orientations th { background: #f3f5f6; }
.orientations th:nth-child(1) { width: 35%; }
.orientations th:nth-child(2) { width: 30%; }
.orientations th:nth-child(3) { width: 8%; }
.orientations th:nth-child(4) { width: 27%; }
.orientations td:first-child { max-width: 520px; overflow-wrap: anywhere; font-family: Consolas, monospace; }
.property { display: inline-block; min-width: 28px; color: var(--muted); }
.yes { color: #187043; font-weight: 600; }
.structure-info sub { font-size: .72em; }
.hidden { display: none !important; }
code { font-family: Consolas, monospace; }
@media (max-width: 850px) {
  body { overflow: auto; }
  main { height: auto; grid-template-columns: 1fr; }
  header { align-items: flex-start; }
  .brand-line { gap: 8px; flex-wrap: wrap; }
  .header-links { display: grid; }
  .sidebar-toggle { display: none; }
  aside { border-right: 0; border-bottom: 1px solid var(--border); }
  .results { min-height: 500px; }
  .results { overflow-x: auto; }
}

footer { min-height: 64px; margin: 0; padding: 9px 20px; border-top: 1px solid var(--border); color: var(--muted); background: var(--panel); font-size: 12px; }
footer p { margin: 2px 0; }
footer a { color: var(--primary); }
.label-with-help { display: inline-flex; align-items: center; gap: 4px; }
.help { position: relative; display: inline-grid; flex: 0 0 14px; place-items: center; width: 14px; min-width: 14px; height: 14px; aspect-ratio: 1; padding: 0; border: 1px solid #8b959c; border-radius: 50%; color: #52606a; background: white; font: 9px/1 Arial, sans-serif; cursor: help; vertical-align: middle; }
.help::after { content: attr(data-help); position: fixed; z-index: 1000; left: var(--tooltip-left, 12px); top: var(--tooltip-top, 12px); box-sizing: border-box; width: min(290px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 8px; color: white; background: #171717; box-shadow: 0 6px 20px rgba(0,0,0,.22); font: 12px/1.45 Arial, sans-serif; text-align: left; white-space: normal; transform: none; opacity: 0; visibility: hidden; pointer-events: none; }
.help:hover::after, .help:focus::after, .help.open::after { opacity: 1; visibility: visible; }
.properties-heading { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 2px; }
.properties-title { display: flex; width: 100%; align-items: center; justify-content: center; gap: 5px; text-align: center; }
.property-labels { display: grid; grid-template-columns: repeat(4, minmax(36px, 1fr)); width: 100%; color: var(--muted); font-weight: 500; white-space: nowrap; text-align: center; }
.property-set { display: grid; grid-template-columns: repeat(4, minmax(36px, 1fr)); align-items: center; gap: 0; text-align: center; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

header #auth-button { margin-left:auto; }
dialog { border:0; border-radius:12px; padding:0; box-shadow:0 20px 60px #0005; width:min(400px,calc(100% - 32px)); }
dialog::backdrop { background:#07111ccc; }
#auth-form { display:grid; gap:14px; padding:28px; position:relative; }
#auth-form label { display:grid; gap:6px; }
#auth-form input, #auth-form select { box-sizing:border-box; width:100%; padding:10px; border:1px solid #ccd3da; border-radius:6px; background:white; color:var(--text); }
.dialog-close { position:absolute; right:12px; top:10px; border:0; background:none; font-size:20px; }
#auth-status { min-height:18px; margin:0; }
#auth-submit {
  width:100%;
  min-height:44px;
  padding:11px 18px;
  border:1px solid var(--primary);
  border-radius:7px;
  color:#fff;
  background:var(--primary);
  box-shadow:0 2px 6px rgba(23,105,170,.22);
  font:600 14px/1.2 Arial, sans-serif;
  letter-spacing:.01em;
  cursor:pointer;
  transition:background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .08s ease;
}
#auth-submit:hover:not(:disabled) {
  border-color:#12588f;
  background:#12588f;
  box-shadow:0 4px 10px rgba(23,105,170,.28);
}
#auth-submit:active:not(:disabled) { transform:translateY(1px); box-shadow:0 1px 3px rgba(23,105,170,.25); }
#auth-submit:focus-visible { outline:3px solid rgba(23,105,170,.24); outline-offset:2px; }
#auth-submit:disabled { opacity:.6; cursor:wait; box-shadow:none; }
.text-button { border:0; background:none; color:#1769aa; }\n.auth-forgot { justify-self:end; margin-top:-8px; padding:2px 0; cursor:pointer; font-size:12px; }
.auth-forgot:hover, .auth-forgot:focus-visible { text-decoration:underline; }


#registration-fields { display:grid; gap:14px; }
#registration-fields.hidden { display:none; }
