* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: #f5f7fa;
    color: #263238;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}

.page-shell {
    display: flex;
    justify-content: center;
    padding: 30px 20px;
}

.link-tool-container {
    width: 100%;
    max-width: 1200px;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.topbar,
.admin-header,
.panel-title-row,
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.title {
    flex: 1;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

.admin-link,
.text-link {
    color: #409eff;
    text-decoration: none;
}

.admin-link {
    flex: 0 0 auto;
    padding: 8px 12px;
    border: 1px solid #d9ecff;
    border-radius: 8px;
}

.link-grid {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.link-item,
.admin-panel,
.login-box {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
}

.link-item {
    padding: 20px;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.link-item:hover {
    border-color: #409eff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.card-title {
    margin-bottom: 15px;
    color: #67c23a;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.link-input {
    width: 100%;
    margin-bottom: 15px;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    color: #555;
    font-size: 14px;
    -webkit-text-security: disc;
    text-security: disc;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}

.copy-btn {
    background: #409eff;
}

.copy-btn:hover {
    background: #337ecc;
}

.jump-btn {
    background: #67c23a;
}

.jump-btn:hover {
    background: #52af3a;
}

.tip {
    min-height: 20px;
    color: #666;
    text-align: center;
    font-size: 13px;
}

.success {
    color: #67c23a;
}

.error {
    color: #f56c6c;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 36px;
    color: #778;
    text-align: center;
    border: 1px dashed #ccd3dc;
    border-radius: 8px;
}

.folder-list {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.folder-file {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 120px;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid #e8edf4;
    border-radius: 8px;
    background: #fbfcfe;
}

.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: #eaf4ff;
    color: #409eff;
    font-size: 12px;
    font-weight: 700;
}

.file-meta {
    min-width: 0;
}

.file-meta h2 {
    overflow: hidden;
    margin-bottom: 6px;
    color: #1f2937;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta p {
    color: #667085;
    font-size: 13px;
}

.folder-download {
    flex: 0 0 auto;
}

.folder-pagination {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.admin-page {
    padding: 28px 20px;
}

.admin-shell {
    max-width: 1160px;
    margin: 0 auto;
}

.admin-header {
    margin-bottom: 18px;
}

.admin-header h1,
.login-box h1 {
    margin-bottom: 6px;
    color: #1f2937;
    font-size: 26px;
}

.admin-header p,
.login-box p {
    color: #667085;
}

.admin-header nav {
    display: flex;
    gap: 10px;
}

.admin-panel {
    margin-top: 18px;
    padding: 22px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.admin-panel h2 {
    margin-bottom: 16px;
    color: #1f2937;
    font-size: 18px;
}

.settings-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: #475467;
    font-size: 14px;
}

.admin-input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #d7dde5;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

.admin-input:focus {
    border-color: #409eff;
    box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.14);
}

.primary-button,
.ghost-button,
.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid #409eff;
    border-radius: 8px;
    background: #409eff;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
}

.ghost-button {
    background: #fff;
    color: #409eff;
}

.ghost-button.danger,
.small-button.danger {
    border-color: #f56c6c;
    color: #f56c6c;
    background: #fff;
}

.small-button {
    min-height: 38px;
    padding: 0 12px;
}

.alert {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: #f0f9eb;
}

.alert.error {
    color: #f56c6c;
    background: #fef0f0;
}

.link-editor-list {
    display: grid;
    gap: 10px;
}

.link-editor-row {
    display: grid;
    grid-template-columns: 68px minmax(160px, 0.8fr) minmax(260px, 1.7fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #edf0f5;
    border-radius: 8px;
    background: #fbfcfe;
}

.drag-handle {
    color: #94a3b8;
    cursor: grab;
    font-size: 13px;
    text-align: center;
    user-select: none;
}

.sortable-ghost {
    opacity: 0.45;
}

.form-actions {
    justify-content: flex-start;
    margin: 16px 0 12px;
}

.login-box {
    width: min(420px, 100%);
    margin: 8vh auto 0;
    padding: 28px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.1);
}

.login-box form {
    display: grid;
    gap: 16px;
    margin: 22px 0 14px;
}

@media (max-width: 820px) {
    .link-tool-container {
        padding: 22px 16px;
    }

    .topbar,
    .admin-header,
    .panel-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .title {
        font-size: 20px;
        text-align: left;
    }

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

    .settings-form,
    .link-editor-row,
    .folder-file {
        grid-template-columns: 1fr;
    }

    .drag-handle {
        text-align: left;
    }
}
