* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #1f2937;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.home-shell {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.home-container {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.home-header {
  text-align: center;
  margin-bottom: 26px;
  padding: 30px 0;
  position: relative;
}

.home-title {
  margin: 0;
  font-size: 2.5rem;
  line-height: 1.2;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.home-subtitle {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.2rem;
  font-weight: 300;
}

.home-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.header-actions {
  position: absolute;
  top: 8px;
  right: 0;
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-status {
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.product-btn {
  width: 100%;
  background: #fff;
  border: none;
  border-radius: 15px;
  padding: 30px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  text-align: center;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.product-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #fff;
}

.product-btn.is-disabled {
  opacity: 0.88;
}

.product-btn.is-disabled:hover {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  color: #fff;
}

.icon {
  font-size: 3rem;
  margin-bottom: 15px;
  transition: color 0.3s ease;
}

.title {
  margin: 16px 0 8px;
  font-size: 1.3rem;
  font-weight: 600;
}

.description {
  margin: 0;
  color: #666;
  line-height: 1.6;
  min-height: 48px;
  transition: color 0.3s ease;
}

.product-btn:hover .description,
.product-btn:hover .product-link-text,
.product-btn:hover .badge {
  color: rgba(255, 255, 255, 0.95);
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  width: 100%;
}

.product-link-text {
  color: #667eea;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(102, 126, 234, 0.12);
}

.badge-neutral {
  color: #475569;
  background: #e2e8f0;
}

.badge-success {
  color: #166534;
  background: #dcfce7;
}

.badge-warn {
  color: #92400e;
  background: #fef3c7;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-secondary {
  color: #1e293b;
  background: #e2e8f0;
}

.btn-danger {
  color: #fff;
  background: #dc2626;
}

.btn-ghost {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.lang-btn,
.login-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.lang-btn:hover,
.login-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.panel {
  margin-top: 22px;
  padding: 20px 22px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.1);
}

.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-text {
  margin: 0;
  color: #475569;
  line-height: 1.7;
}

.notice {
  white-space: pre-line;
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid transparent;
}

.home-notice {
  width: min(520px, calc(100% - 32px));
  margin: -8px auto 18px;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
  text-align: center;
}

.notice-error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.notice-info {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.footer {
  text-align: center;
  padding: 20px 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  margin-top: auto;
}

.tool-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
}

.tool-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  background: #0f172a;
  color: #fff;
}

.tool-topbar h1 {
  margin: 0;
  font-size: 20px;
}

.tool-topbar p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
}

.tool-frame-wrap {
  flex: 1;
  padding: 16px;
}

.tool-frame {
  width: 100%;
  min-height: calc(100vh - 104px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  background: #fff;
}

.auth-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
  z-index: 1000;
}

.auth-backdrop[hidden] {
  display: none !important;
}

.auth-modal {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  padding: 0;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.auth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.auth-title {
  margin: 0;
  font-size: 16px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 16px 0;
}

.auth-tab {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
}

.auth-tab.is-active {
  background: #2563eb;
  color: #fff;
}

.auth-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.form-label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 600;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}

.password-field {
  position: relative;
}

.password-field .form-input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #475569;
  padding: 0;
}

.password-toggle:hover {
  background: #f1f5f9;
}

.password-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.form-textarea {
  min-height: 96px;
  resize: vertical;
}

.form-textarea-compact {
  min-height: 56px;
}

.admin-status-select {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
}

.admin-remark-textarea {
  min-height: 42px;
  padding: 8px 12px;
  line-height: 1.45;
}

.admin-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-helper {
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.form-error {
  color: #b91c1c;
  font-size: 14px;
}

.form-success {
  color: #166534;
  font-size: 14px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.admin-shell {
  min-height: 100vh;
  background: #f8fafc;
}

.admin-container {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-title {
  margin: 0;
  font-size: 30px;
}

.admin-subtitle {
  margin: 8px 0 0;
  color: #64748b;
}

.admin-table-wrap {
  overflow-x: auto;
  margin-top: 20px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.admin-view-switch {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.admin-panel {
  margin-top: 20px;
  padding: 20px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-panel-title {
  margin: 0;
  font-size: 20px;
}

.admin-panel-desc {
  margin: 8px 0 0;
  color: #64748b;
  line-height: 1.6;
}

.admin-config-card {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #f8fafc;
  padding: 16px;
}

.admin-config-card + .admin-config-card {
  margin-top: 16px;
}

.admin-config-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.admin-config-card-title {
  margin: 0;
  font-size: 18px;
}

.admin-config-card-desc {
  margin: 8px 0 0;
  color: #64748b;
  line-height: 1.6;
}

.admin-config-card-body {
  margin-top: 14px;
}

.admin-config-card-body.is-hidden {
  display: none;
}

.admin-material-textarea {
  min-height: 180px;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

.admin-remark-config-textarea {
  min-height: 120px;
}

.admin-code-textarea {
  min-height: 420px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
}

.admin-config-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-lock-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.admin-lock-badge.is-unlocked {
  background: #dcfce7;
  color: #166534;
}

.admin-parameter-editor {
  display: grid;
  gap: 16px;
}

.admin-subsection {
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
}

.admin-subsection-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.admin-subsection-title {
  margin: 0;
  font-size: 16px;
  color: #0f172a;
}

.admin-subsection-desc {
  margin: 6px 0 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.admin-factor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-factor-field {
  margin: 0;
}

.admin-factor-field span {
  display: block;
  margin-bottom: 6px;
}

.admin-factor-field-wide {
  grid-column: span 2;
}

.parameter-table-wrap {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.parameter-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.parameter-table th,
.parameter-table td {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
  text-align: left;
}

.parameter-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

.parameter-table-input {
  min-width: 120px;
}

.admin-hbeam-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.admin-hbeam-toolbar-field {
  margin: 0;
}

.admin-hbeam-toolbar-field span {
  display: block;
  margin-bottom: 6px;
}

.admin-hbeam-toolbar-summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.admin-advanced-json {
  background: #f8fafc;
}

.admin-material-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.admin-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 600;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.admin-table th,
.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

.admin-table td {
  color: #1f2937;
  font-size: 14px;
}

.muted {
  color: #64748b;
  font-size: 12px;
}

@media (max-width: 800px) {
  .panel-row,
  .tool-topbar,
  .admin-header,
  .admin-panel-header,
  .admin-config-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-actions,
  .form-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .header-actions {
    position: static;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
  }

  .header-status {
    width: 100%;
    text-align: center;
    white-space: normal;
  }

  .tool-frame-wrap {
    padding: 10px;
  }

  .home-title {
    font-size: 2rem;
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .home-container {
    padding: 15px 0;
  }

  .home-notice {
    width: min(420px, calc(100% - 24px));
    margin: -4px auto 16px;
  }

  .product-meta {
    flex-direction: column;
  }
}
