html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
    background: #f4f7fb;
    color: #172033;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
}

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

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

button {
    cursor: pointer;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 248px;
    background: linear-gradient(180deg, #0d1b2b 0%, #10243e 100%);
    color: #ffffff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    box-shadow: 8px 0 30px rgba(10, 18, 36, 0.12);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #4f8cff 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 1px;
    box-shadow: 0 10px 30px rgba(79, 140, 255, 0.3);
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
}

.brand-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.menu-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.main-panel {
    flex: 1;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.topbar {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 22px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

.page-subtitle {
    margin-top: 6px;
    color: #64748b;
    font-size: 14px;
}

.topbar-actions,
.inline-actions,
.filter-actions,
.pagination-controls,
.section-row,
.split-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.section.active {
    display: flex;
}

.section-header h2,
.card-header h3,
.form-section h4,
.modal-header h3 {
    margin: 0;
}

.section-header p,
.muted,
.card-header p,
.modal-header p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 14px;
}

.card {
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid #e5edf6;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px 0;
}

.card-header.split-header {
    justify-content: space-between;
    align-items: flex-start;
}

.filter-grid,
.form-grid {
    display: grid;
    gap: 16px;
}

.filter-grid {
    padding: 20px 24px 24px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

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

.form-grid.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field,
.toggle-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span,
.toggle-field span,
.param-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.field input,
.field select,
.field textarea,
.upload-inline input,
.schema-item input,
.schema-item select,
.version-item input,
.version-item select,
.version-item textarea {
    width: 100%;
    border: 1px solid #d8e2ef;
    border-radius: 12px;
    padding: 11px 12px;
    background: #ffffff;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.upload-inline input:focus,
.schema-item input:focus,
.schema-item select:focus,
.version-item input:focus,
.version-item select:focus,
.version-item textarea:focus {
    border-color: #4f8cff;
    box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.12);
}

.full-width {
    grid-column: 1 / -1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

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

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #4f8cff 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.btn-secondary {
    background: #eef4fb;
    color: #1e3a8a;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-small {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
}

.table-wrap {
    overflow-x: auto;
    padding: 18px 20px 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1260px;
}

.data-table thead th {
    text-align: left;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: #64748b;
    font-weight: 700;
    padding: 12px 14px;
    background: #f8fbff;
    border-bottom: 1px solid #e2e8f0;
}

.data-table tbody td {
    padding: 16px 14px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: top;
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: #f8fbff;
}

.empty-state,
.empty-card {
    text-align: center;
    color: #94a3b8;
    padding: 36px 16px;
}

.monospace {
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 12px;
}

.link-text {
    color: #2563eb;
    word-break: break-all;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

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

.status-chip.warning {
    background: #fef3c7;
    color: #92400e;
}

.status-chip.muted {
    background: #e2e8f0;
    color: #475569;
}

.action-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.text-button {
    padding: 0;
    border: none;
    background: transparent;
    color: #2563eb;
    font-weight: 600;
}

.text-button.danger {
    color: #dc2626;
}

.status-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-switch input {
    width: 42px;
    height: 24px;
    appearance: none;
    background: #dbe4ef;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease;
}

.status-switch input::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    top: 3px;
    left: 3px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
    transition: transform 0.2s ease;
}

.status-switch input:checked {
    background: #3b82f6;
}

.status-switch input:checked::after {
    transform: translateX(18px);
}

.list-footer {
    padding: 18px 24px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.summary-text {
    color: #64748b;
    font-size: 14px;
}

.template-grid,
.upload-grid,
.param-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.template-list,
.upload-history {
    padding: 18px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.template-card {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.template-body {
    padding: 16px 18px;
    display: flex;
    gap: 14px;
}

.template-preview {
    width: 92px;
    min-width: 92px;
    height: 72px;
    border-radius: 14px;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 22px;
    font-weight: 700;
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-title-row,
.template-actions,
.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.template-name {
    font-size: 16px;
    font-weight: 700;
}

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

.template-description {
    color: #475569;
    font-size: 13px;
    line-height: 1.6;
}

.template-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meta-tag {
    padding: 6px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
}

.upload-card {
    min-height: 320px;
}

.upload-box {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.upload-box input[type="file"] {
    border: 1px dashed #bfdbfe;
    background: #f8fbff;
    border-radius: 16px;
    padding: 24px 16px;
}

.upload-result-panel {
    padding: 0 24px 24px;
    color: #334155;
    word-break: break-all;
}

.upload-record {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px 16px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-trigger {
    position: relative;
    overflow: hidden;
}

.file-input,
.version-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

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

.modal.open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
}

.modal-panel {
    position: relative;
    width: min(860px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    background: #ffffff;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.24);
}

.modal-panel-xl {
    width: min(1160px, calc(100vw - 32px));
}

.modal-header,
.modal-footer {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-footer {
    border-bottom: none;
    border-top: 1px solid #e2e8f0;
    justify-content: flex-end;
}

.sticky-footer {
    position: sticky;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
}

.modal-body {
    padding: 22px 24px 28px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: #eef4fb;
    color: #0f172a;
    font-size: 22px;
}

.form-section {
    padding: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #fbfdff;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.compact-section {
    padding-top: 14px;
}

.version-list,
.schema-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.version-item,
.schema-item {
    border: 1px solid #dce7f3;
    border-radius: 16px;
    padding: 16px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.version-item-head,
.schema-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.version-item-title,
.schema-item-title {
    font-weight: 700;
    color: #0f172a;
}

.preview-link-box {
    min-height: 44px;
    border-radius: 14px;
    padding: 12px 14px;
    background: #eff6ff;
    color: #1e40af;
    word-break: break-all;
}

.toggle-field {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    border: 1px solid #dce7f3;
    border-radius: 14px;
    padding: 12px 14px;
    background: #ffffff;
}

.toggle-field input {
    width: 18px;
    height: 18px;
}

.dynamic-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 96px;
}

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

.param-field-grid .full-width {
    grid-column: 1 / -1;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 260px;
    max-width: 380px;
    padding: 14px 16px;
    border-radius: 14px;
    color: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.toast.success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.info {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

@media (max-width: 1240px) {
    .filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .template-grid,
    .upload-grid,
    .param-panels {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .admin-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-radius: 0 0 22px 22px;
    }

    .main-panel {
        padding: 18px;
    }

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

    .filter-grid,
    .form-grid.two-columns,
    .form-grid.three-columns,
    .param-field-grid {
        grid-template-columns: 1fr;
    }

    .upload-inline {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 640px) {
    .modal {
        padding: 0;
    }

    .modal-panel,
    .modal-panel-xl {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .list-footer,
    .topbar-actions,
    .inline-actions,
    .pagination-controls,
    .filter-actions {
        flex-wrap: wrap;
    }
}

body {
    background: #f0f2f5;
    color: #1e293b;
}

.admin-layout {
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 256px;
    padding: 0;
    gap: 0;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    overflow: hidden;
}

.brand {
    padding: 20px 24px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 16px;
}

.brand-title {
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-subtitle {
    color: rgba(226, 232, 240, 0.7);
}

.menu-group {
    padding: 14px 16px 0;
}

.menu-group.compact {
    margin-top: auto;
}

.menu-caption {
    padding: 0 10px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.menu {
    gap: 6px;
}

.menu-item {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(255, 255, 255, 0.1);
}

.menu-icon {
    width: 18px;
    height: 18px;
    background: transparent;
    border-radius: 0;
}

.menu-icon i {
    width: 18px;
    height: 18px;
    stroke-width: 2.25;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.28);
}

.sidebar-user-name {
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.sidebar-user-role {
    margin-top: 2px;
    color: #64748b;
    font-size: 12px;
}

.main-panel {
    padding: 16px 18px 18px;
    gap: 16px;
    overflow: hidden;
    background: #f0f2f5;
}

.topbar {
    min-height: 64px;
    padding: 14px 22px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.topbar-title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.topbar-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

.topbar-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: #2563eb;
    font-size: 11px;
    font-weight: 700;
}

.page-subtitle {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.topbar-actions {
    gap: 10px;
}

.topbar-actions .btn {
    min-width: 96px;
}

.section {
    gap: 16px;
    min-height: 0;
}

.section.active {
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
}

.card {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.filter-card {
    overflow: visible;
}

.software-filter-grid {
    padding: 18px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 18px;
}

.field-inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.field-inline span {
    width: 58px;
    flex: none;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-align: right;
}

.field-inline input,
.field-inline select {
    height: 34px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: none;
    font-size: 12px;
}

.field-inline input:focus,
.field-inline select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.field-inline input:disabled {
    background: #f8fafc;
    color: #94a3b8;
}

.software-filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 10px;
    padding-top: 16px;
    margin-top: 2px;
    border-top: 1px solid #f1f5f9;
}

.btn {
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
}

.btn-secondary {
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.btn-soft-primary {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.06);
}

.btn-soft-success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #d1fae5;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.06);
}

.software-filter-actions .btn {
    min-width: 88px;
    padding: 8px 18px;
}

.software-table-wrap {
    padding: 0;
}

.software-data-table {
    min-width: 1100px;
}

.software-data-table thead th {
    padding: 12px 16px;
    background: #f8fafc;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.software-data-table tbody td {
    padding: 18px 16px;
    border-bottom: 1px solid #eef2f7;
    font-size: 12px;
    vertical-align: middle;
}

.software-data-table tbody tr:hover {
    background: #fafcff;
}

.software-id-cell {
    color: #64748b;
    font-weight: 500;
    text-align: center;
}

.software-name-text {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.software-price-text {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

.status-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.status-tag.blue {
    background: #eff6ff;
    border-color: #dbeafe;
    color: #2563eb;
}

.status-tag.green {
    background: #ecfdf5;
    border-color: #d1fae5;
    color: #059669;
}

.status-tag.slate {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #64748b;
}

.software-template-lines,
.software-meta-lines,
.software-actions {
    display: flex;
    flex-direction: column;
}

.software-template-lines {
    gap: 4px;
    font-size: 11px;
    color: #94a3b8;
}

.software-template-lines strong {
    color: #334155;
    font-weight: 700;
}

.software-meta-lines {
    gap: 4px;
    color: #94a3b8;
    font-size: 10px;
    line-height: 1.5;
    white-space: nowrap;
}

.dual-switch-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-switch-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
}

.mini-switch-label {
    width: 38px;
    flex: none;
    color: #94a3b8;
    text-align: right;
}

.mini-switch {
    position: relative;
    width: 26px;
    height: 14px;
    flex: none;
}

.mini-switch input {
    appearance: none;
    width: 26px;
    height: 14px;
    margin: 0;
    border-radius: 999px;
    background: #e2e8f0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mini-switch input::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s ease;
}

.mini-switch input:checked {
    background: #3b82f6;
}

.mini-switch input:checked::after {
    transform: translateX(12px);
}

.mini-switch-state {
    color: #cbd5e1;
}

.mini-switch-state.on {
    color: #2563eb;
}

.software-edit-link,
.software-action-link {
    padding: 0;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.software-edit-link {
    color: #2563eb;
}

.software-action-link {
    color: #64748b;
    white-space: nowrap;
}

.software-action-link.primary {
    color: #2563eb;
}

.software-action-link.danger {
    color: #ef4444;
}

.software-edit-link:hover,
.software-action-link:hover {
    text-decoration: underline;
}

.software-actions {
    align-items: flex-end;
    gap: 6px;
}

.software-list-footer {
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    background: #ffffff;
}

.summary-text {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
}

.software-pagination {
    gap: 8px;
}

.pager-btn {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #ffffff;
    color: #64748b;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.pager-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid #bfdbfe;
    background: #3b82f6;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.statistics-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.statistics-heading h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.statistics-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.statistics-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

.statistics-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.statistics-icon i {
    width: 28px;
    height: 28px;
}

.accent-orange .statistics-icon {
    background: #f97316;
    box-shadow: 0 12px 24px rgba(249, 115, 22, 0.18);
}

.accent-green .statistics-icon {
    background: #34d399;
    box-shadow: 0 12px 24px rgba(52, 211, 153, 0.18);
}

.accent-pink .statistics-icon {
    background: #f472b6;
    box-shadow: 0 12px 24px rgba(244, 114, 182, 0.18);
}

.accent-indigo .statistics-icon {
    background: #6366f1;
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.18);
}

.statistics-card-body {
    min-width: 0;
}

.statistics-label {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.statistics-value {
    margin-top: 2px;
    color: #0f172a;
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
}

.statistics-trend {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
}

.statistics-trend.up {
    color: #10b981;
}

.statistics-trend.down {
    color: #f43f5e;
}

.statistics-chart-card {
    overflow: hidden;
}

.statistics-chart-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.statistics-chart-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.statistics-range-tabs {
    display: flex;
    gap: 4px;
    padding: 2px;
    border-radius: 8px;
    background: #f1f5f9;
}

.range-tab {
    border: none;
    background: transparent;
    color: #64748b;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.range-tab.active {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.18);
}

.statistics-legend {
    display: flex;
    justify-content: center;
    gap: 28px;
    flex-wrap: wrap;
    padding: 16px 20px 0;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 2px solid transparent;
}

.legend-dot.indigo {
    background: #eef2ff;
    border-color: #818cf8;
}

.legend-dot.pink {
    background: #fdf2f8;
    border-color: #f472b6;
}

.legend-dot.emerald {
    background: #ecfdf5;
    border-color: #34d399;
}

.statistics-chart-wrap {
    height: 420px;
    padding: 16px 20px 24px;
}

.template-grid {
    gap: 18px;
}

.template-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.template-card {
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.template-card:hover {
    transform: translateY(-2px);
    border-color: #dbeafe;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.template-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.template-preview {
    width: 100%;
    min-width: 100%;
    height: 158px;
    border-radius: 0;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.template-preview-empty {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
}

.template-main {
    padding: 16px;
    gap: 12px;
}

.template-title-row {
    align-items: flex-start;
}

.template-name {
    font-size: 16px;
}

.template-description {
    min-height: 40px;
    font-size: 12px;
}

.template-meta {
    gap: 6px;
}

.meta-tag {
    padding: 5px 8px;
    font-size: 11px;
}

.template-actions {
    padding-top: 12px;
    border-top: 1px solid #f8fafc;
}

.action-links {
    gap: 12px;
}

.text-button {
    font-size: 12px;
    font-weight: 700;
}

.upload-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 18px;
}

.upload-box {
    align-items: center;
    justify-content: center;
    min-height: 260px;
    margin: 18px;
    border: 2px dashed #bfdbfe;
    border-radius: 18px;
    background: rgba(239, 246, 255, 0.72);
    text-align: center;
}

.upload-box input[type="file"] {
    width: 100%;
    max-width: 420px;
    border: none;
    background: transparent;
    padding: 0;
}

.upload-history {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.upload-record {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.upload-record-title {
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
}

.upload-record-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    color: #94a3b8;
    font-size: 11px;
}

.modal-panel,
.modal-panel-xl {
    border-radius: 20px;
}

.modal-header,
.modal-footer {
    padding: 18px 20px;
}

.modal-body {
    padding: 20px;
}

.form-section {
    border-radius: 16px;
}

.param-panels {
    gap: 16px;
}

.preview-link-box {
    background: #eff6ff;
}

.toast {
    border-radius: 12px;
}

@media (max-width: 1320px) {
    .software-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 1080px) {
    .software-filter-grid,
    .template-grid,
    .upload-grid,
    .statistics-cards {
        grid-template-columns: 1fr;
    }

    .field-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .field-inline span {
        width: auto;
        text-align: left;
    }

    .topbar {
        align-items: flex-start;
    }
}

@media (max-width: 960px) {
    .admin-layout {
        flex-direction: column;
        max-height: none;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar-footer {
        display: none;
    }

    .main-panel {
        overflow: visible;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* ========= 自适应补丁：防止 100% 缩放下内容被切掉 ========= */

/* 1) 侧边栏菜单过长时内部可滚，不撑破整个布局。 */
.sidebar {
    overflow-y: auto;
}

/* 2) 中等屏 1440px 及以下：收窄侧边栏，给主内容区让出空间；
      并让表格允许横向滚动（不再强制 1100px 让右侧列被切）。*/
@media (max-width: 1440px) {
    .sidebar {
        width: 220px;
    }
    .main-panel {
        padding: 14px 16px 16px;
    }
    .topbar-actions .btn {
        min-width: 80px;
    }
    .software-data-table {
        min-width: 960px;
    }
}

/* 3) 更窄笔记本 1280px 以下：侧边栏再收窄，避免主内容区过挤。*/
@media (max-width: 1280px) {
    .sidebar {
        width: 200px;
    }
    .software-data-table {
        min-width: 880px;
    }
}

/* 4) 视口高度 820px 以下（笔记本 + 任务栏 + 浏览器 UI 常见情形）：
      解除 admin-layout 的 100vh 高度锁，允许整页自然纵向滚动，
      同时模态框缩小外边距确保头尾可见。*/
@media (max-height: 820px) {
    .admin-layout {
        max-height: none;
        overflow: visible;
    }
    .main-panel {
        overflow: visible;
    }
    .section.active {
        overflow-y: visible;
    }
    .modal {
        padding: 10px;
    }
    .modal-panel,
    .modal-panel-xl {
        max-height: calc(100vh - 20px);
    }
    .modal-header,
    .modal-footer {
        padding: 12px 18px;
    }
    .modal-body {
        padding: 14px 18px 18px;
        gap: 14px;
    }
    .form-section {
        padding: 14px;
        gap: 12px;
    }
}
