:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: #f4f7fb;
  color: #172033;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: #f4f7fb;
}

main {
  min-height: 100vh;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 12px 28px rgba(35, 49, 78, 0.08);
}

.login-panel label,
.settings-form label {
  display: grid;
  gap: 7px;
}

.login-panel label {
  margin-top: 22px;
}

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #172033;
  color: #fff;
  padding: 18px 14px;
  z-index: 3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #1463d9;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #9eabc1;
  margin-top: 3px;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-item {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  color: #cfd7e6;
  text-align: left;
  padding: 11px 12px;
}

.nav-item:hover,
.nav-item.active {
  background: #24314a;
  color: #fff;
}

.nav-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.workspace {
  min-width: 0;
}

.admin-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid #dbe3ef;
}

.content-view {
  padding: 24px 28px;
}

.breadcrumb {
  color: #6b768a;
  font-size: 14px;
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.3;
}

h2 {
  font-size: 20px;
}

p {
  color: #5b6475;
  margin-top: 6px;
}

a,
button {
  font: inherit;
}

.download,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: #1463d9;
  color: #fff;
  font-size: 15px;
  padding: 11px 16px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.download:hover,
button:hover {
  background: #0f53b8;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary {
  background: #e8eef7;
  color: #172033;
}

.secondary:hover {
  background: #d9e3f1;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 340px));
  gap: 16px;
}

.tool-card {
  min-width: 0;
  min-height: 158px;
  display: grid;
  gap: 12px;
  justify-items: start;
  text-align: left;
  white-space: normal;
  background: #fff;
  color: #172033;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  padding: 20px;
  overflow: hidden;
}

.tool-card:hover {
  background: #fafdff;
  border-color: #8fa7c8;
}

.tool-card.disabled {
  opacity: 0.75;
}

.tool-card.disabled:hover {
  background: #fff;
  border-color: #dbe3ef;
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #1463d9;
  color: #fff;
  font-weight: 700;
}

.tool-icon.muted {
  background: #d9e3f1;
  color: #52627a;
}

.tool-card strong {
  font-size: 17px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.tool-card span:last-child {
  color: #5b6475;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.panel,
.result {
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  padding: 20px;
}

.settings-panel {
  margin-top: 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.section-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.model-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  color: #5b6475;
  font-size: 14px;
}

.model-summary strong {
  color: #172033;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9a5b00;
}

.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #d98b00;
}

.status-dot.ready {
  color: #16713d;
}

.status-dot.ready::before {
  background: #22a35a;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.login-panel label span,
.settings-form label span {
  color: #31415c;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd9e8;
  border-radius: 6px;
  padding: 9px 11px;
  font: inherit;
  color: #172033;
  background: #fff;
}

.login-panel button {
  width: 100%;
  margin-top: 18px;
}

.settings-form button {
  align-self: end;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #dbe3ef;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
  padding: 22px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  background: #eef3fa;
  color: #172033;
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  background: #dfe8f5;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 16px;
  align-items: stretch;
}

.dropzone {
  border: 1px dashed #8fa7c8;
  border-radius: 8px;
  padding: 22px;
  cursor: pointer;
  background: #fafdff;
}

.dropzone input {
  display: block;
  margin-top: 14px;
}

.title {
  display: block;
  font-weight: 700;
  font-size: 17px;
}

.hint {
  display: block;
  color: #657083;
  margin-top: 6px;
}

.result {
  margin-top: 18px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 16px;
}

.result-header span {
  color: #657083;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid #e3e9f2;
  border-left: 1px solid #e3e9f2;
}

.field {
  min-height: 72px;
  padding: 12px;
  border-right: 1px solid #e3e9f2;
  border-bottom: 1px solid #e3e9f2;
}

.field b {
  display: block;
  margin-bottom: 8px;
  color: #31415c;
}

.field span {
  color: #172033;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .brand {
    padding: 4px 4px 12px;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-top: 12px;
    padding-bottom: 2px;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
  }

  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .admin-header,
  .section-title,
  .upload,
  .settings-form,
  .result-header {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    min-height: auto;
    padding: 16px;
  }

  .content-view {
    padding: 16px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .result {
    padding: 16px;
  }

  .section-actions,
  .modal-actions {
    justify-content: stretch;
  }

  .section-actions > *,
  .modal-actions > *,
  #submitButton {
    width: 100%;
  }

  .dropzone {
    padding: 18px;
  }

  .modal {
    align-items: end;
    padding: 12px;
  }

  .modal-panel {
    width: 100%;
    max-height: calc(100vh - 24px);
    padding: 18px;
  }
}
