:root {
  --bg-1: #ecf5ff;
  --bg-2: #eefcf5;
  --ink: #152436;
  --ink-soft: #54667a;
  --line: #d7e1ed;
  --panel: #ffffff;
  --accent: #0f9a77;
  --accent-2: #1d6dbe;
  --danger: #c63c3c;
  --shadow: 0 16px 34px rgba(20, 42, 64, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: linear-gradient(140deg, var(--bg-1), var(--bg-2));
}

body.modal-open {
  overflow: hidden;
}

.backdrop {
  position: fixed;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
  z-index: -1;
}

.backdrop-a {
  width: 380px;
  height: 380px;
  background: rgba(15, 154, 119, 0.14);
  right: -120px;
  top: -120px;
}

.backdrop-b {
  width: 340px;
  height: 340px;
  background: rgba(29, 109, 190, 0.13);
  left: -130px;
  bottom: -110px;
}

.app-shell {
  width: min(1260px, 94vw);
  margin: 26px auto 50px;
  display: grid;
  gap: 14px;
}

.hero {
  animation: rise 420ms ease;
}

.tag {
  margin: 0;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--accent-2);
  font-weight: 700;
}

h1 {
  margin: 8px 0;
  font-size: clamp(30px, 4vw, 44px);
  font-family: "Source Han Serif SC", "Songti SC", serif;
}

.intro {
  margin: 0;
  color: var(--ink-soft);
}

.hero-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  animation: rise 380ms ease;
}

.login-panel {
  max-width: 460px;
}

.console {
  display: grid;
  gap: 14px;
}

.hidden {
  display: none;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

h2,
h3 {
  margin: 0;
}

h2 {
  font-size: 21px;
}

h3 {
  font-size: 19px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 13px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(29, 109, 190, 0.2);
  border-color: var(--accent-2);
}

.inline-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inline-tools.compact {
  margin-bottom: 10px;
}

.inline-tools label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 13px;
}

.inline-tools input {
  width: auto;
}

.table-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  white-space: nowrap;
  text-align: left;
}

th {
  background: #f4f9ff;
}

tr:hover td {
  background: #f8fcff;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.btn-ghost {
  background: #edf3fb;
  color: var(--ink);
}

.btn-danger {
  background: #fff0f0;
  color: var(--danger);
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--accent-2);
  cursor: pointer;
  font-weight: 700;
  padding: 0;
}

.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.secret-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.secret-text {
  display: inline-block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.muted {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

code {
  background: #edf4ff;
  border-radius: 6px;
  padding: 2px 6px;
  font-family: "JetBrains Mono", "Consolas", monospace;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 22, 36, 0.48);
}

.modal-card {
  position: relative;
  width: min(920px, 94vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(10, 24, 40, 0.3);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

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

#licenseForm > label {
  margin: 0;
}

#licenseForm > button[type="submit"] {
  grid-column: 1 / -1;
}

.raw-text {
  min-height: 190px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  line-height: 1.5;
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  #licenseForm {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: 95vw;
  }

  .panel {
    padding: 14px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .inline-tools {
    width: 100%;
  }

  .inline-tools input {
    flex: 1;
    min-width: 130px;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    padding: 12px;
  }
}
