* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

:root {
    --brand-from: #6a11cb;
    --brand-to: #2575fc;
    --brand-grad: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    --tap: 44px;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    line-height: 1.6;
    height: 100vh;
    padding: 0;
    margin: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 登录页（保持原样） ===== */
.login-page-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-page-inner {
    width: 100%;
    max-width: 440px;
}

.login-card-page {
    margin: 0 auto;
}

.login-back-row {
    margin-bottom: 12px;
}

.login-back-link {
    color: #2575fc;
    font-size: 0.9rem;
    text-decoration: none;
}

.login-back-link:hover {
    text-decoration: underline;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    padding: 28px 24px 32px;
}

.login-brand {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 8px;
    font-weight: 600;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-sub {
    text-align: center;
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 22px;
}

.login-form .login-submit {
    width: 100%;
    margin-top: 10px;
}

.login-error {
    color: #dc3545;
    font-size: 0.88rem;
    margin: 6px 0 0;
}

/* ===== 容器 ===== */
.container {
    width: 90%;
    height: 100vh;
    max-width: 1200px;
    margin: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== 顶部应用栏 ===== */
.appbar {
    background: var(--brand-grad);
    color: #fff;
    flex-shrink: 0;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    box-shadow: 0 2px 10px rgba(106, 17, 203, 0.25);
    z-index: 30;
}

.appbar-menu-btn {
    width: var(--tap);
    height: var(--tap);
    flex-shrink: 0;
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.3rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.appbar-menu-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.appbar-menu-btn[hidden] {
    display: none !important;
}

.appbar-title {
    flex: 1;
    min-width: 0;
}

.site-header-title {
    font-size: 1.4rem;
    margin: 0;
    font-weight: 600;
    line-height: 1.2;
}

.appbar-subtitle {
    display: block;
    font-size: 0.72rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-login-link {
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.12);
    white-space: nowrap;
}

.header-login-link:hover {
    background: rgba(255, 255, 255, 0.22);
}

.header-login-link[hidden] {
    display: none !important;
}

.appbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
}

.appbar-avatar[hidden] {
    display: none !important;
}

/* ===== 菜单栏 ===== */
.menu-bar {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 0 12px;
    min-height: 42px;
    flex-shrink: 0;
}

.menu-bar[hidden] {
    display: none !important;
}

.menu-item {
    position: relative;
}

.menu-button {
    border: none;
    background: transparent;
    color: #212529;
    padding: 8px 12px;
    font-size: 0.95rem;
    border-radius: 6px;
    cursor: pointer;
}

.menu-button:hover,
.menu-item:hover .menu-button,
.menu-item:focus-within .menu-button {
    background: #e9ecef;
}

.edit-done-button {
    margin-left: auto;
    border: none;
    border-radius: 6px;
    background: #2575fc;
    color: #fff;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 7px 14px;
}

.edit-done-button:hover {
    background: #1d63d8;
}

.edit-done-button[hidden] {
    display: none !important;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    display: none;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    min-width: 260px;
    z-index: 1000;
    padding: 6px 0;
}

.menu-item:hover .dropdown-menu,
.menu-item:focus-within .dropdown-menu {
    display: block;
}

.menu-item.dropdown-closed .dropdown-menu {
    display: none;
}

.dropdown-item {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: #212529;
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f1f3f5;
}

.menu-link {
    display: block;
    text-decoration: none;
}

/* ===== 搜索条 ===== */
.toolbar {
    flex-shrink: 0;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f3f5;
    border: 1px solid #e3e7ec;
    border-radius: 14px;
    padding: 0 14px;
    height: var(--tap);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus-within {
    border-color: #2575fc;
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.15);
    background: #fff;
}

.search-box svg {
    flex-shrink: 0;
    opacity: 0.55;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.95rem;
    color: #212529;
    min-width: 0;
}

.search-box input::placeholder {
    color: #aeb4bd;
}

.search-clear {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #ced4da;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.search-clear:hover {
    background: #adb5bd;
}

.search-clear[hidden] {
    display: none !important;
}

/* ===== 快捷分类 chips ===== */
.chips {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    background: #f1f3f5;
    border: 1px solid #e9ecef;
    color: #495057;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chip:hover {
    background: #e9ecef;
}

.chip.active {
    background: var(--brand-grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(37, 117, 252, 0.3);
}

/* ===== 主内容 ===== */
.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: row;
    overflow: hidden;
}

/* 抽屉菜单（通用：桌面为侧边栏，移动端为 off-canvas 抽屉） */
.sidebar-drawer {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-drawer.drawer-open {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1500;
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
}

.sidebar-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--brand-grad);
    color: white;
    flex-shrink: 0;
}

.sidebar-drawer-title {
    font-size: 1rem;
    font-weight: 600;
}

.drawer-close-btn {
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.drawer-close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.drawer-overlay.drawer-overlay-visible {
    opacity: 1;
    pointer-events: auto;
}

.drawer-overlay[hidden],
.sidebar-drawer[hidden] {
    display: none !important;
}

.sidebar-drawer-inner {
    flex: 1;
    overflow-y: auto;
}

.sidebar-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 20px;
    background: var(--brand-grad);
    color: white;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

/* 文件树样式 */
.file-tree {
    padding: 10px;
    min-height: 350px;
    display: block !important;
    background: white;
}

.tree-node {
    margin: 5px 0;
}

.tree-folder {
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 5px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #495057;
    user-select: none;
    background: transparent;
}

.tree-folder:hover {
    background: rgba(37, 117, 252, 0.1);
    color: #2575fc;
}

.tree-folder.selected {
    background: rgba(37, 117, 252, 0.15);
    color: #2575fc;
}

.tree-folder::before {
    content: '▶';
    display: inline-block;
    margin-right: 5px;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
    width: 12px;
    text-align: center;
}

.tree-folder.expanded::before {
    transform: rotate(90deg);
}

.tree-folder-icon {
    margin-right: 8px;
    font-size: 1rem;
    width: 20px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.custom-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
}

.tree-children {
    margin-left: 20px;
    padding-left: 10px;
    border-left: 1px solid #dee2e6;
    display: none;
}

.tree-children.expanded {
    display: block;
}

.tree-folder.expanded {
    color: #2575fc;
}

.tree-leaf {
    cursor: pointer;
    padding: 6px 10px 6px 28px;
    border-radius: 5px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    color: #6c757d;
    font-size: 0.9rem;
    background: transparent;
}

.tree-leaf:hover {
    background: rgba(37, 117, 252, 0.1);
    color: #2575fc;
}

.tree-leaf-icon {
    margin-right: 8px;
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tree-leaf .custom-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

/* 右侧内容区 */
.content-area {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    padding: 20px 30px;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

.content-header h2 {
    margin: 0 0 8px 0;
    color: #212529;
    font-size: 1.8rem;
}

.current-path {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
    font-family: monospace;
}

.link-content {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    background: white;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.welcome-message h3 {
    margin-bottom: 15px;
    color: #495057;
}

/* 搜索结果头 */
.search-result-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 4px 16px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #212529;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 16px;
}

.search-result-head .muted {
    font-size: 0.85rem;
    font-weight: 400;
    color: #6c757d;
}

/* 分类标题 */
.category-title {
    font-size: 1.5rem;
    color: #212529;
    margin-top: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.category-separator {
    border: none;
    border-top: 1px dashed #dee2e6;
    margin: 20px 0;
}

/* 链接卡片网格 */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 16px;
    padding: 10px 0;
}

.link-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 14px 10px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    z-index: 1;
    pointer-events: auto !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 92px;
    text-align: center;
}

.link-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: #2575fc;
    background: rgba(37, 117, 252, 0.05);
}

.link-card-delete {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 3;
    width: 22px;
    height: 22px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
    color: #fff;
    background: rgba(220, 53, 69, 0.95);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.link-card-delete:hover {
    background: #c82333;
}

.link-card-delete:focus-visible {
    outline: 2px solid #2575fc;
    outline-offset: 1px;
}

body.edit-mode .link-card-delete {
    display: flex;
}

.link-card-order {
    position: absolute;
    top: -2px;
    left: -5px;
    color: rgba(67, 97, 238, 0.08);
    font-size: 7.5rem;
    font-weight: 100;
    line-height: 1;
    background: transparent;
    border: none;
    pointer-events: none;
    letter-spacing: -1px;
    z-index: 0;
}

.link-card-icon,
.link-card-title {
    position: relative;
    z-index: 1;
}

.link-card-icon {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
}

.link-card-icon .custom-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    margin: 0 auto;
}

.link-card-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #212529;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 空状态提示 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.empty-state-text {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.empty-state-detail {
    color: #6c757d;
    font-size: 0.9rem;
}

.empty-state-detail-warning,
.empty-state-detail-link {
    font-size: 0.85rem;
    margin-top: 10px;
}

.empty-state-detail-warning {
    color: #856404;
}

.empty-state-detail-link {
    color: #3498db;
}

.empty-state-detail-error {
    color: #e74c3c;
}

.loading {
    text-align: center;
    padding: 50px;
    color: #6c757d;
    font-size: 1.1rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== 底部导航（移动端） ===== */
.tabbar {
    display: none;
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 6px 0 calc(env(safe-area-inset-bottom, 0px) + 6px);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
    z-index: 30;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #6c757d;
    font-size: 0.72rem;
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
}

.tab .ti {
    font-size: 1.3rem;
    line-height: 1;
}

.tab.active {
    color: #2575fc;
}

.tab.active .ti {
    transform: translateY(-1px);
}

footer {
    text-align: center;
    padding: 10px;
    color: #6c757d;
    font-size: 0.9rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

body.edit-mode .link-card {
    border-color: #f59f00;
    box-shadow: 0 0 0 2px rgba(245, 159, 0, 0.25);
}

body.edit-mode .link-card:hover {
    transform: none;
}

body.edit-mode .tree-leaf {
    border-left: 3px solid rgba(245, 159, 0, 0.6);
}

body.edit-mode .link-card,
body.edit-mode .tree-leaf {
    cursor: grab;
}

.dragging {
    opacity: 0.45;
}

.link-drop-placeholder {
    min-height: 84px;
    border: 2px dashed #2575fc;
    border-radius: 8px;
    background: rgba(37, 117, 252, 0.06);
    pointer-events: none;
}

.tree-folder.drag-over,
.link-content.drag-over {
    outline: 2px dashed #2575fc;
    outline-offset: -3px;
    background: rgba(37, 117, 252, 0.06);
}

.tree-leaf.drop-before,
.tree-leaf.drop-after {
    position: relative;
}

.tree-leaf.drop-before::before,
.tree-leaf.drop-after::after {
    content: '';
    position: absolute;
    left: 24px;
    right: 8px;
    height: 2px;
    border-radius: 999px;
    background: #2575fc;
}

.tree-leaf.drop-before::before {
    top: -2px;
}

.tree-leaf.drop-after::after {
    bottom: -2px;
}

/* 书签编辑对话框 */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(33, 37, 41, 0.45);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-dialog {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 40px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    flex-shrink: 0;
}

.modal-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #212529;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.75rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 6px;
}

.modal-close:hover {
    background: #e9ecef;
    color: #212529;
}

.modal-body {
    padding: 18px 20px 22px;
    overflow-y: auto;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 0.9rem;
    color: #495057;
}

.modal-field span:first-child {
    font-weight: 500;
}

.modal-field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-field-label-row label {
    font-weight: 500;
}

.modal-field-link {
    color: #2575fc;
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
}

.modal-field-link:hover {
    text-decoration: underline;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.95rem;
    font-family: inherit;
}

.modal-field textarea {
    resize: vertical;
    min-height: 72px;
}

.modal-field-readonly {
    margin-bottom: 10px;
}

.modal-readonly-value {
    font-family: ui-monospace, 'Courier New', monospace;
    font-size: 0.85rem;
    color: #6c757d;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.modal-actions-spacer {
    flex: 1;
}

.modal-delete-button[hidden] {
    display: none !important;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    border: none;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: var(--brand-grad);
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-secondary {
    background: #e9ecef;
    color: #212529;
}

.btn-secondary:hover {
    background: #dee2e6;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #bb2d3b;
}

/* ===== 移动端（≤768px） ===== */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        padding: 0;
        align-items: flex-start;
    }

    .container {
        width: 100%;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        max-width: none;
        border-radius: 0;
    }

    .site-header-title {
        font-size: 1.2rem;
    }

    .site-header-subtitle,
    .appbar-subtitle {
        font-size: 0.68rem;
    }

    .menu-bar {
        flex-wrap: wrap;
        padding: 6px 8px;
        gap: 4px;
    }

    .menu-button {
        padding: 6px 10px;
        font-size: 0.85rem;
        min-height: 44px;
    }

    .dropdown-item {
        min-height: 44px;
        padding: 10px 12px;
    }

    .dropdown-menu {
        min-width: 200px;
        position: static;
        box-shadow: none;
        border: none;
        background: #f8f9fa;
        border-radius: 6px;
        margin-top: 4px;
    }

    .menu-item:hover .dropdown-menu,
    .menu-item:focus-within .dropdown-menu,
    .menu-item.dropdown-open .dropdown-menu {
        display: block;
    }

    /* 移动端：drawer 默认 off-canvas */
    .sidebar-drawer {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-right: 1px solid #e9ecef;
    }

    .sidebar-drawer.drawer-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .drawer-close-btn {
        display: flex;
    }

    .main-content {
        flex-direction: column;
        min-height: 0;
    }

    .content-area {
        min-height: 0;
        max-height: none;
        overflow: visible;
        width: 100%;
    }

    .link-content {
        overflow-y: visible;
        padding: 16px;
    }

    .content-header {
        padding: 14px 16px;
    }

    .content-header h2 {
        font-size: 1.2rem;
    }

    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
        gap: 12px;
    }

    .link-card {
        padding: 10px 8px;
        min-height: 84px;
    }

    .link-card-icon {
        font-size: 1.3rem;
        min-height: 26px;
    }

    .link-card-title {
        font-size: 0.72rem;
    }

    /* 移动端：显示底部导航，隐藏页脚 */
    .tabbar {
        display: flex;
    }

    footer {
        display: none;
    }

    .modal-dialog {
        max-width: calc(100% - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 12px;
    }

    .modal-body {
        padding: 14px 16px 20px;
    }
}

/* 错误状态样式 */
.error {
    text-align: center;
    padding: 40px;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 8px;
    margin: 20px 0;
}

.error h3 {
    margin-bottom: 15px;
    color: #721c24;
}

.retry-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 15px;
    transition: background 0.3s ease;
}

.retry-btn:hover {
    background: #c82333;
}
