:root {
    --home-bg: #f4f6fb;
    --home-border: #e4e8f0;
    --home-ink: #1f2937;
    --home-brand: #1f3864;
    --home-accent: #2e75b6;
}

body {
    background: var(--home-bg);
    color: var(--home-ink);
}

/* 顶栏 */
.app-topbar {
    background: #fff;
    border-bottom: 1px solid var(--home-border);
    min-height: 64px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-topbar .container-xl {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 64px;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: var(--home-brand);
    font-weight: 600;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1f3864, #2e75b6);
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    box-shadow: 0 6px 16px rgba(46, 117, 182, .35);
}

.brand-mark-lg {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    font-size: 26px;
}

.brand-text {
    font-size: 16px;
    letter-spacing: .02em;
}

/* 登录页 */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 10%, #e8eefb 0%, #f4f6fb 45%, #eef2f9 100%);
    padding: 2rem 1rem;
}

.login-shell {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-brand {
    margin-bottom: 1.5rem;
}

.login-brand h1 {
    font-size: 1.6rem;
    margin: 1rem 0 .35rem;
    color: var(--home-brand);
}

.login-card {
    text-align: left;
    border: 1px solid var(--home-border);
    box-shadow: 0 18px 48px rgba(31, 56, 100, .12);
}

.login-foot {
    margin-top: 1.25rem;
    color: #94a3b8;
    font-size: 12px;
    letter-spacing: .08em;
}

/* 工作台头部 */
.page-body {
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
}

.home-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.home-greeting {
    font-size: 1.5rem;
    margin: 0 0 .25rem;
}

.home-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.home-actions .input-icon {
    width: 220px;
}

.home-actions .input-icon .form-control {
    padding-left: 2.2rem;
}

.home-actions .input-icon-addon {
    position: absolute;
    left: .7rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

/* 链接卡片 */
.link-tile {
    position: relative;
    height: 100%;
    border: 1px solid var(--home-border);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    overflow: hidden;
}

.link-tile:hover {
    transform: translateY(-2px);
    border-color: #c9d6ea;
    box-shadow: 0 14px 34px rgba(31, 56, 100, .12);
}

.link-tile-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: 100%;
    padding: 1rem 1rem 1.05rem;
    color: inherit;
    text-decoration: none;
}

.link-tile-actions {
    position: absolute;
    top: .45rem;
    right: .45rem;
    display: flex;
    gap: .15rem;
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 2;
}

.link-tile:hover .link-tile-actions,
.link-tile:focus-within .link-tile-actions {
    opacity: 1;
}

.link-tile-actions form {
    margin: 0;
}

.link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #f1f5fb;
    margin-bottom: .85rem;
    overflow: hidden;
}

.link-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.link-icon-letter {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.tile-color-0 { background: linear-gradient(135deg, #2e75b6, #4f9be0); }
.tile-color-1 { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.tile-color-2 { background: linear-gradient(135deg, #b45309, #f59e0b); }
.tile-color-3 { background: linear-gradient(135deg, #9d174d, #ec4899); }
.tile-color-4 { background: linear-gradient(135deg, #4c1d95, #8b5cf6); }
.tile-color-5 { background: linear-gradient(135deg, #166534, #22c55e); }
.tile-color-6 { background: linear-gradient(135deg, #991b1b, #ef4444); }
.tile-color-7 { background: linear-gradient(135deg, #1e3a8a, #3b82f6); }

.link-title {
    display: block;
    max-width: 100%;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-host {
    display: block;
    max-width: 100%;
    margin-top: .15rem;
    color: #94a3b8;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-desc {
    display: -webkit-box;
    margin-top: .45rem;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 空状态 */
.empty-state {
    margin: 2rem auto 0;
    max-width: 520px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: #fff;
    border: 1px dashed #cbd8ea;
    border-radius: 16px;
}

.empty-mark {
    font-size: 2.5rem;
    color: #2e75b6;
    margin-bottom: .75rem;
}

.empty-state h3 {
    margin-bottom: .5rem;
}

.empty-state p {
    margin-bottom: 1.25rem;
}

/* 表单页 */
.form-narrow {
    max-width: 720px;
}

.form-label.required::after {
    content: " *";
    color: #dc2626;
}

.current-icon {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-top: .75rem;
}

.current-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
    background: #f1f5fb;
    padding: 2px;
}

/* 错误页 */
.error-shell {
    max-width: 520px;
    margin: 12vh auto 0;
    padding: 2rem;
    text-align: center;
}

.error-code {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    color: #2e75b6;
    margin-bottom: .5rem;
}

.error-shell h1 {
    font-size: 1.5rem;
    margin-bottom: .75rem;
}

.error-shell p {
    margin-bottom: 1.5rem;
}

@media (max-width: 575.98px) {
    .home-actions {
        width: 100%;
        margin-left: 0;
    }

    .home-actions .input-icon {
        flex: 1;
        width: auto;
    }
}
