:root {
  --bg: #f3f4f6;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card: #ffffff;
  --accent: #0f172a;
  --el-color-primary: #0f172a;
  --el-color-primary-light-3: #334155;
  --el-color-primary-light-5: #64748b;
  --el-color-primary-light-7: #94a3b8;
  --el-color-primary-light-8: #cbd5e1;
  --el-color-primary-light-9: #e2e8f0;
  --el-color-primary-dark-2: #020617;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(15, 23, 42, 0.08), transparent 60%),
    radial-gradient(700px 360px at 100% 0%, rgba(15, 23, 42, 0.05), transparent 55%),
    var(--bg);
}

.login-shell {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px 28px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.06);
}

.login-shell.is-qr-only {
  padding: 40px 32px 32px;
  text-align: center;
}

.login-shell .brand {
  margin-bottom: 24px;
}

.login-shell.is-qr-only .brand {
  margin-bottom: 28px;
}

.login-shell .brand h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--ink);
}

.login-shell .brand p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-form .el-form-item {
  margin-bottom: 16px;
}

.login-submit {
  width: 100%;
  height: 40px;
  margin-top: 4px;
}

.qq-entry {
  width: 100%;
  height: 40px;
  margin-top: 12px;
}

.qq-panel {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.qq-panel.qq-only {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.qq-frame {
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qq-qr {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
  background: #fff;
}

.qq-skeleton {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    #e5e7eb 0%,
    #f3f4f6 40%,
    #e5e7eb 80%
  );
  background-size: 200% 100%;
  animation: qq-shimmer 1.2s ease infinite;
}

@keyframes qq-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.qq-hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 12px;
  min-height: 21px;
}

.qq-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 120px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.qq-refresh:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.qq-refresh:active:not(:disabled) {
  transform: scale(0.98);
}

.qq-refresh:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .login-shell,
  .login-shell.is-qr-only {
    padding: 28px 20px 24px;
  }

  .qq-frame {
    width: 180px;
    height: 180px;
  }
}

.dash-shell {
  min-height: 100vh;
  background:
    radial-gradient(1000px 480px at 0% -20%, rgba(15, 23, 42, 0.07), transparent 55%),
    radial-gradient(800px 400px at 100% 0%, rgba(15, 23, 42, 0.04), transparent 50%),
    var(--bg);
}

.dash-header {
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.dash-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dash-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.dash-header .meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.meta-text {
  color: var(--muted);
  font-size: 12px;
}

.logout-btn {
  border-radius: 8px;
}

.dash-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #94a3b8;
}

.stat-card.is-total::before { background: #0f172a; }
.stat-card.is-unused::before { background: #64748b; }
.stat-card.is-active::before { background: #15803d; }
.stat-card.is-bad::before { background: #b45309; }

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.stat-card .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.dash-body {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel-card {
  border-radius: 14px !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.03) !important;
  overflow: hidden;
}

.panel-card .el-card__header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}

.panel-card .el-card__body {
  padding: 18px;
}

.panel-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-title {
  font-weight: 650;
  font-size: 15px;
  color: var(--ink);
}

.panel-desc {
  color: var(--muted);
  font-size: 12px;
}

.field-block {
  margin: 4px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
}

.field-block-title {
  font-size: 12px;
  font-weight: 650;
  color: #374151;
  margin-bottom: 8px;
}

.field-block .el-form-item {
  margin-bottom: 10px;
}

.field-block .el-form-item:last-child {
  margin-bottom: 0;
}

.seg-group {
  display: flex;
  width: 100%;
}

.seg-group .el-radio-button {
  flex: 1;
}

.seg-group .el-radio-button__inner {
  width: 100%;
  border-radius: 0 !important;
}

.seg-group .el-radio-button:first-child .el-radio-button__inner {
  border-radius: 8px 0 0 8px !important;
}

.seg-group .el-radio-button:last-child .el-radio-button__inner {
  border-radius: 0 8px 8px 0 !important;
}

.create-form .el-form-item {
  margin-bottom: 12px;
}

.create-form .el-form-item__label {
  margin-bottom: 4px !important;
  line-height: 1.4;
  color: var(--muted);
  font-size: 12px;
}

.create-submit,
.create-copy {
  width: 100%;
  height: 40px;
  border-radius: 8px;
}

.create-copy {
  margin-top: 10px;
}

.list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.list-header .panel-head {
  flex: 1;
  min-width: 120px;
}

.list-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-tools .el-select {
  width: 132px;
}

.license-table .el-table__cell {
  vertical-align: middle !important;
  padding: 14px 0 !important;
}

.license-table .cell {
  line-height: 1.4;
  padding-left: 12px;
  padding-right: 12px;
}

.license-table th.el-table__cell {
  background: #f8fafc !important;
  color: #6b7280;
  font-weight: 600;
}

.code-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.code-cell code,
.code-cell .code-click {
  font-family: ui-monospace, Consolas, "SF Mono", monospace;
  font-size: 12px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-click {
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.code-click:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.code-cell .note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-cell {
  font-size: 13px;
  color: #374151;
  white-space: nowrap;
}

.time-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.time-main {
  font-size: 13px;
  color: #111827;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hb-ok { color: #15803d; }
.hb-warn { color: #b45309; }
.hb-bad { color: #b91c1c; }
.hb-muted { color: var(--muted); }

.edit-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.edit-meta-item {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.edit-meta-item .k {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.edit-meta-item .v {
  display: block;
  font-size: 12px;
  color: #111827;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.created-box {
  margin-top: 12px;
  background: #0b1220;
  color: #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, Consolas, monospace;
}

.edit-dialog .el-dialog__header {
  padding: 18px 20px 12px;
  margin-right: 0;
}

.edit-dialog .el-dialog__body {
  padding: 8px 20px 4px;
}

.edit-dialog .el-dialog__footer {
  padding: 12px 20px 18px;
}

.edit-dialog-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 24px;
}

.edit-dialog-title {
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
}

.edit-dialog-code {
  display: inline-block;
  width: fit-content;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  color: #334155;
}

.edit-form .el-form-item {
  margin-bottom: 12px;
}

.edit-form .el-form-item__label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px !important;
}

.edit-section {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}

.edit-section-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: 12px;
}

.expire-now {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px dashed var(--line);
  color: #374151;
  font-size: 13px;
  line-height: 1.5;
}

.expire-mode .el-radio-button {
  flex: 1 1 25%;
}

.expire-mode .el-radio-button__inner {
  padding-left: 8px;
  padding-right: 8px;
  font-size: 12px;
}

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.extend-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  appearance: none;
  -webkit-appearance: none;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  background-color: #fff;
  color: #374151;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  outline: none;
  box-shadow: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease,
    transform 150ms ease;
}

.chip:hover:not(:disabled):not(.active) {
  border-color: #94a3b8;
  background: #f8fafc;
  background-color: #f8fafc;
  color: #111827;
}

.chip:focus-visible:not(.active) {
  border-color: #0f172a;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12);
  background: #fff;
  background-color: #fff;
  color: #111827;
}

.chip.active,
.chip.active:hover,
.chip.active:focus,
.chip.active:focus-visible,
.chip.active:active {
  background: #0f172a !important;
  background-color: #0f172a !important;
  border-color: #0f172a !important;
  color: #fff !important;
  box-shadow: none;
}

.chip:active:not(:disabled) {
  transform: scale(0.98);
}

.chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.date-quick {
  margin-top: -4px;
  margin-bottom: 8px;
}

.edit-dialog .el-date-editor.el-input,
.edit-dialog .el-date-editor.el-input__wrapper {
  width: 100%;
}

.el-picker__popper.el-popper {
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.el-date-picker,
.el-picker-panel {
  border: none;
}

.el-date-table td.available:hover div {
  background: #f1f5f9;
  color: var(--ink);
}

.el-date-table td.current:not(.disabled) .el-date-table-cell__text,
.el-date-table td.current:not(.disabled) div {
  background: #0f172a !important;
  color: #fff !important;
  border-radius: 8px;
  font-weight: 600;
}

.el-date-table td.today .el-date-table-cell__text,
.el-date-table td.today span {
  color: #0f172a;
  font-weight: 650;
}

.el-picker-panel__footer {
  border-top: 1px solid var(--line);
}

.el-picker-panel__link-btn {
  color: #0f172a !important;
}

.el-time-spinner__item.is-active:not(.is-disabled) {
  color: #0f172a;
  font-weight: 650;
}

.edit-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mt-form {
  margin-top: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dash-body-single {
  grid-template-columns: minmax(0, 1fr);
}

.mini-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  cursor: pointer;
}

.apps-create {
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 960px) {
  .dash-body {
    grid-template-columns: 1fr;
  }

  .dash-body-single {
    grid-template-columns: 1fr;
  }

  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .edit-grid {
    grid-template-columns: 1fr;
  }

  .edit-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dash-header-inner,
  .dash-main {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 560px) {
  .stat-strip {
    grid-template-columns: 1fr 1fr;
  }

  .seg-group {
    flex-wrap: wrap;
  }

  .seg-group .el-radio-button {
    flex: 1 1 45%;
  }
}
