.legacy {--bg: #F4F1EA;
  --surface: #FFFFFF;
  --surface-2: #FAF8F3;
  --ink: #2A2722;
  --ink-2: #6E665B;
  --ink-3: #9A9186;
  --line: #E7E1D6;
  --line-soft: #F0ECE3;
  --accent: #5E7C6B;       
  --accent-deep: #4A6557;
  --accent-soft: #EDF1EC;
  --bronze: #9C7A53;       
  --seal: #B23A2E;         
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 2px 14px rgba(42, 39, 34, 0.06);
  --shadow-lg: 0 12px 40px rgba(42, 39, 34, 0.12);
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;}
.legacy * {box-sizing: border-box; margin: 0; padding: 0;}
.legacy {font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;}
.legacy button {font-family: inherit; cursor: pointer;}
.legacy input, .legacy textarea, .legacy select {font-family: inherit; font-size: 14px;}
.legacy .login-wrap {min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(94,124,107,0.06), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(156,122,83,0.06), transparent 40%),
    var(--bg);}
.legacy .login-card {width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 44px 38px;
  text-align: center;}
.legacy .login-seal {width: 52px; height: 52px; margin: 0 auto 18px;
  border-radius: 12px; background: var(--seal); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 26px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(178,58,46,0.28);}
.legacy .login-title {font-family: var(--serif); font-size: 22px; letter-spacing: 2px;}
.legacy .login-sub {color: var(--ink-3); font-size: 13px; margin: 8px 0 28px; letter-spacing: 1px;}
.legacy .field {text-align: left; margin-bottom: 16px;}
.legacy .field label {display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .5px;}
.legacy .field input {width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;}
.legacy .field input:focus {outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);}
.legacy .btn {display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; letter-spacing: 1px; transition: all .18s; background: var(--surface-2); color: var(--ink-2);}
.legacy .btn:hover {background: var(--line-soft);}
.legacy .btn-primary {background: var(--accent); color: #fff; width: 100%; padding: 12px;}
.legacy .btn-primary:hover {background: var(--accent-deep);}
.legacy .btn-ghost {background: transparent; border-color: var(--line);}
.legacy .btn-sm {padding: 6px 12px; font-size: 13px;}
.legacy .btn-danger {background: #fff; color: var(--seal); border-color: rgba(178,58,46,0.3);}
.legacy .btn-danger:hover {background: rgba(178,58,46,0.06);}
.legacy .login-tip {margin-top: 18px; font-size: 12px; color: var(--ink-3);}
.legacy .app {display: flex; min-height: 100vh;}
.legacy .sidebar {width: 220px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--line); padding: 24px 16px;
  display: flex; flex-direction: column;}
.legacy .brand {display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; border-bottom: 1px solid var(--line-soft);}
.legacy .brand-seal {width: 36px; height: 36px; border-radius: 9px; background: var(--seal); color:#fff;
  display:flex; align-items:center; justify-content:center; font-family: var(--serif); font-weight:700;}
.legacy .brand-name {font-family: var(--serif); font-size: 16px; letter-spacing: 1px;}
.legacy .nav {margin-top: 18px; display: flex; flex-direction: column; gap: 4px;}
.legacy .nav-item {display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-radius: var(--radius-sm); color: var(--ink-2); font-size: 14px;
  border: 1px solid transparent; transition: all .15s; text-align: left; background: none; width: 100%;}
.legacy .nav-item:hover {background: var(--surface-2); color: var(--ink);}
.legacy .nav-item.active {background: var(--accent-soft); color: var(--accent-deep); border-color: rgba(94,124,107,0.2); font-weight: 600;}
.legacy .nav-icon {width: 18px; text-align: center; opacity: .85;}
.legacy .sidebar-foot {margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft);}
.legacy .main {flex: 1; display: flex; flex-direction: column; min-width: 0;}
.legacy .topbar {height: 60px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;}
.legacy .topbar h1 {font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: 1px;}
.legacy .topbar .who {color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: 12px;}
.legacy .content {padding: 28px; overflow: auto;}
.legacy .stat-grid {display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px;}
.legacy .stat-card {background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);}
.legacy .stat-num {font-family: var(--serif); font-size: 30px; color: var(--accent-deep);}
.legacy .stat-label {color: var(--ink-2); font-size: 13px; margin-top: 4px; letter-spacing: .5px;}
.legacy .panel {background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);}
.legacy .panel-head {display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft);}
.legacy .panel-head h2 {font-family: var(--serif); font-size: 16px; font-weight: 600; letter-spacing: .5px;}
.legacy .toolbar {display: flex; gap: 10px; align-items: center; flex-wrap: wrap;}
.legacy .toolbar input, .legacy .toolbar select {padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink);}
.legacy .table {width: 100%; border-collapse: collapse;}
.legacy .table th, .legacy .table td {padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line-soft); font-size: 13px;}
.legacy .table th {color: var(--ink-3); font-weight: 600; font-size: 12px; letter-spacing: .5px; background: var(--surface-2);}
.legacy .table tr:hover td {background: var(--surface-2);}
.legacy .cell-thumb {width: 48px; height: 48px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line);}
.legacy .tag {display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px;}
.legacy .tag-on {background: var(--accent-soft); color: var(--accent-deep);}
.legacy .tag-off {background: #F1ECE4; color: var(--ink-3);}
.legacy .tag-general {background: var(--accent-soft); color: var(--accent-deep);}
.legacy .tag-skill {background: rgba(156,122,83,0.12); color: var(--bronze);}
.legacy .row-actions {display: flex; gap: 8px;}
.legacy .price {color: var(--bronze); font-weight: 600; font-variant-numeric: tabular-nums;}
.legacy .modal-mask {position: fixed; inset: 0; background: rgba(42,39,34,0.42); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 50;}
.legacy .modal {width: 680px; max-width: 100%; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);}
.legacy .modal-head {display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line-soft);}
.legacy .modal-head h3 {font-family: var(--serif); font-size: 17px; letter-spacing: .5px;}
.legacy .modal-body {padding: 22px 24px; max-height: 66vh; overflow: auto;}
.legacy .modal-foot {display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line-soft);}
.legacy .form-row {margin-bottom: 16px;}
.legacy .form-row label {display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .5px;}
.legacy .form-row input, .legacy .form-row textarea, .legacy .form-row select {width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink);}
.legacy .chapter-edit {border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; background: var(--surface-2);}
.legacy .chapter-edit-head {display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; color: var(--ink-2);}
.legacy .chapter-edit-head select {width: auto; padding: 5px 8px;}
.legacy .chapter-edit-head .btn-danger {margin-left: auto;}
.legacy .chapter-edit-body {display: grid; grid-template-columns: 1fr 1fr; gap: 8px;}
.legacy .chapter-edit-body textarea {grid-column: 1 / -1; min-height: 64px;}
.legacy .form-row textarea {min-height: 70px; resize: vertical;}
.legacy .form-row input:focus, .legacy .form-row textarea:focus, .legacy .form-row select:focus {outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);}
.legacy .form-grid {display: grid; grid-template-columns: 1fr 1fr; gap: 14px;}
.legacy .close-x {background: none; border: none; font-size: 22px; color: var(--ink-3); line-height: 1;}
.legacy .upload-box {border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 16px; text-align: center; background: var(--surface-2); cursor: pointer; color: var(--ink-3);}
.legacy .upload-box:hover {border-color: var(--accent); color: var(--accent);}
.legacy .preview-img {max-width: 100%; max-height: 160px; border-radius: 6px; margin-top: 10px; border: 1px solid var(--line);}
.legacy .editor-toolbar {display: flex; gap: 4px; flex-wrap: wrap; padding: 8px; border: 1px solid var(--line); border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--surface-2);}
.legacy .editor-toolbar button {width: 32px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 5px; color: var(--ink-2); font-size: 13px;}
.legacy .editor-toolbar button:hover {border-color: var(--accent); color: var(--accent);}
.legacy .editor-area {min-height: 180px; border: 1px solid var(--line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: 14px; background: #fff; outline: none;}
.legacy .editor-area:focus {border-color: var(--accent);}
.legacy .editor-area img {max-width: 100%; border-radius: 4px;}
.legacy .editor-area h3 {font-family: var(--serif); margin: 8px 0;}
.legacy .editor-area p {margin: 6px 0;}
.legacy .spec-row {display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center;}
.legacy .spec-row input {padding: 8px 10px;}
.legacy .empty-tip {padding: 50px; text-align: center; color: var(--ink-3);}
.legacy .pager {display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 20px; color: var(--ink-2); font-size: 13px;}
.legacy .toast {position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 20px; font-size: 13px; z-index: 99; box-shadow: var(--shadow-lg);}

/* 嵌入宿主后台的补充样式 */
.legacy { min-width: 0; }
.legacy .login-wrap { min-height: 62vh; }
.legacy .legacy-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.legacy .legacy-title { font-family: var(--serif); font-size: 16px; font-weight: 600; letter-spacing: .5px; color: var(--ink); }
.legacy .legacy-who { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 13px; }
.legacy .content { padding: 0; }
/* 宿主层级适配：legacy 弹窗需高于宿主顶栏(100)但低于宿主弹窗(1000+) */
.legacy .modal-mask { z-index: 500; }
.legacy .toast { z-index: 600; }
