:root {
    --primary-color: #007AFF;
    --error-color: #FF3B30;
    --text-color: #333;
    --text-secondary: #666;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-gradient);
    color: var(--text-color);
    overflow: hidden;
    position: relative;
}

.card {
    background: rgba(255, 255, 255, 0.9);
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 360px;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
    z-index: 10;
    box-sizing: border-box;
}

h2 { margin-top: 0; margin-bottom: 10px; font-weight: 600; color: #1a1a1a; }
.desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 25px; }

.input-group { margin-bottom: 20px; }
input {
    width: 100%; padding: 12px 15px; box-sizing: border-box;
    border: 2px solid #eee; border-radius: 10px; font-size: 16px;
    outline: none; transition: border-color 0.3s; text-align: center; letter-spacing: 1px;
}
input:focus { border-color: var(--primary-color); }

button, .btn {
    display: block; width: 100%; padding: 12px;
    background-color: var(--primary-color); color: white;
    border: none; border-radius: 10px; font-size: 16px; font-weight: 500;
    cursor: pointer; box-sizing: border-box;
    transition: background-color 0.3s, transform 0.1s;
    text-align: center; text-decoration: none;
}
button:hover, .btn:hover { background-color: #0062cc; }
button:active, .btn:active { transform: scale(0.98); }

.btn-outline {
    background-color: transparent; border: 2px solid var(--primary-color); color: var(--primary-color);
}
.btn-outline:hover { background-color: rgba(0, 122, 255, 0.05); }

.btn-mini {
    width: auto; padding: 6px 12px; font-size: 12px;
    background: #eee; color: #333; border: none; border-radius: 8px; cursor: pointer;
}
.btn-mini:hover { background: #e5e5e5; }

.footer { margin-top: 20px; font-size: 12px; color: #999; }
.footer a { color: #999; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

#msg {
    margin-top: 15px; font-size: 13px; height: 20px;
    color: var(--error-color); opacity: 0; transition: opacity 0.3s;
}

.p2p-container { width: 92%; max-width: 900px; max-height: 94vh; overflow-y: auto; }
.status-bar { margin-bottom: 10px; padding: 10px; background: rgba(255, 255, 255, 0.4); border-radius: 10px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#connection-status[data-state="success"] { color: #188038; }
#connection-status[data-state="working"] { color: #b06000; }
#connection-status[data-state="error"] { color: #d93025; }
.connection-panel { margin-bottom: 14px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.52); text-align: left; }
.connection-steps { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.connection-step { color: #888; font-size: 12px; padding: 5px 9px; border-radius: 999px; border: 1px solid rgba(0,0,0,0.08); background: rgba(255,255,255,0.5); transition: all .2s; }
.connection-step b { display: inline-flex; width: 17px; height: 17px; align-items: center; justify-content: center; border-radius: 50%; background: #ddd; color: #666; margin-right: 3px; }
.connection-step.active { color: #9a5a00; border-color: #f0b35a; background: #fff7e8; }
.connection-step.active b { background: #f0a43a; color: white; }
.connection-step.done { color: #188038; border-color: #8bc99a; background: #eefaf1; }
.connection-step.done b { background: #34a853; color: white; }
.connection-step.failed { color: #d93025; border-color: #e5a19b; background: #fff1f0; }
.connection-step.failed b { background: #d93025; color: white; }
.connection-arrow { color: #aaa; font-size: 12px; }
.connection-detail { margin-top: 9px; color: #666; font-size: 12px; text-align: center; line-height: 1.5; word-break: break-all; }
.user-list { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.user-tag { background: rgba(0, 122, 255, 0.1); color: var(--primary-color); padding: 5px 10px; border-radius: 20px; font-size: 12px; border: 1px solid rgba(0, 122, 255, 0.2); display: flex; align-items: center; gap: 5px; }
.user-tag.self { background: rgba(52, 199, 89, 0.1); color: #28a745; border-color: rgba(52, 199, 89, 0.2); }
.peer-mini-status { color: #666; background: rgba(255,255,255,.65); border-radius: 999px; padding: 1px 6px; font-size: 10px; }
.admin-star { color: #d99a00; }

.drop-zone { position: relative; border: 2px dashed rgba(0, 0, 0, 0.1); border-radius: 15px; padding: 40px; text-align: center; transition: all 0.3s; cursor: pointer; margin-bottom: 20px; z-index: 10; }
.drop-zone:hover, .drop-zone.dragover { background: rgba(255, 255, 255, 0.5); border-color: var(--primary-color); }

.file-list { text-align: left; max-height: 360px; overflow-y: auto; }
.file-item { background: rgba(255, 255, 255, 0.55); margin-bottom: 10px; padding: 10px; border-radius: 10px; font-size: 13px; }
.file-top { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.file-name { flex: 1; word-break: break-all; }
.file-action { min-width: 70px; text-align:right; display:flex; align-items:center; justify-content:flex-end; gap:8px; }
.file-action-content { white-space:nowrap; }
.file-cancel { width:auto; margin:0; padding:4px 9px; border-radius:6px; background:#FF3B30; font-size:11px; line-height:1.2; }
.file-cancel:hover { background:#d32f2f; }
.file-speed { margin-left:8px; color:#188038; white-space:nowrap; }
.progress-bar { height: 4px; background: #eee; border-radius: 2px; margin-top: 8px; width: 100%; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary-color); width: 0%; transition: width 0.2s; }
.file-sub { display:flex; justify-content:space-between; margin-top:6px; font-size:11px; color:#666; gap:10px; }
.ip-badge { font-size: 10px; background: #333; color: #fff; padding: 1px 4px; border-radius: 4px; margin-left: 5px; }

#admin-panel, #transfer-section { display: none; }
.file-item.cleared { opacity: 0.45; filter: grayscale(1); }
.file-item.cleared a { pointer-events:none; text-decoration:none; color:#777 !important; }
.file-item.cancelled { opacity:0.68; }
.file-item.cancelled .progress-fill { background:#999; }
.action-text { font-size: 12px; color: var(--primary-color); cursor: pointer; }
.action-text.disabled { color:#999; cursor: default; }

.room-list-container { margin-top: 25px; border-top: 1px solid rgba(0,0,0,0.05); padding-top: 15px; }
.room-item { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.6); padding: 10px 15px; margin-bottom: 8px; border-radius: 8px; font-size: 13px; }
.room-info { display: flex; flex-direction: column; gap: 2px; }
.room-id { font-weight: bold; color: #333; }
.room-meta { font-size: 11px; color: #666; }
.btn-close-room { background: #FF3B30; color: white; border: none; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.btn-close-room:hover { background: #d32f2f; }
.hint { font-size: 12px; color: #888; margin-top: 6px; line-height: 1.6; }
.empty-text { font-size: 12px; color: #999; text-align: center; }

@media (max-width: 600px) {
    body.page-p2p { align-items: flex-start; overflow-y: auto; }
    .p2p-container { width: 100%; max-height: none; min-height: 100vh; border-radius: 0; padding: 24px 16px; }
    .status-bar { align-items: flex-start; flex-direction: column; }
    .connection-arrow { display: none; }
    .connection-steps { justify-content: flex-start; }
    .drop-zone { padding: 30px 12px; }
}

.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-box {
    background: rgba(255, 255, 255, 0.95);
    width: 85%; max-width: 320px;
    padding: 25px; border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
    transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.active .modal-box { transform: scale(1); }

.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 10px; color: #333; }
.modal-msg { font-size: 14px; color: #666; margin-bottom: 25px; line-height: 1.5; }

.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-btn { flex: 1; padding: 10px 0; border-radius: 10px; border: none; font-size: 14px; cursor: pointer; transition: background 0.2s; }
.modal-btn.cancel { background: #f0f0f0; color: #666; }
.modal-btn.cancel:hover { background: #e5e5e5; }
.modal-btn.confirm { background: var(--primary-color); color: white; }
.modal-btn.confirm:hover { background: #0062cc; }

.bg-text {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 35vw; font-weight: 900; color: rgba(0, 0, 0, 0.03);
    z-index: 0; pointer-events: none; user-select: none;
}
body.page-403 .bg-text { color: rgba(255, 59, 48, 0.04); }

.content { position: relative; z-index: 1; text-align: center; padding: 0 20px; }
.content h1 { font-size: 48px; font-weight: 800; margin: 0 0 20px 0; letter-spacing: -1px; }
.content p { font-size: 18px; color: var(--text-secondary); margin: 0 0 40px 0; line-height: 1.6; max-width: 500px; }

body.dh-page {
    --dh-primary-color: #007AFF;
    --dh-primary-soft: rgba(0, 122, 255, 0.1);
    --dh-text-color: #333;
    --dh-text-secondary: #666;
    --dh-bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --dh-card-bg: rgba(255, 255, 255, 0.85);
    --dh-blur-val: 20px;
}

body.dh-page {
    background: var(--dh-bg-gradient);
    color: var(--dh-text-color);
}

body.dh-page .dh-gallery {
    background: var(--dh-card-bg);
    backdrop-filter: blur(var(--dh-blur-val));
    -webkit-backdrop-filter: blur(var(--dh-blur-val));
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    width: 90%;
    max-width: 1000px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

body.dh-page .dh-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: rgba(255,255,255,0.5);
}

body.dh-page .dh-title h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1c1c1e;
}

body.dh-page .dh-title span {
    font-size: 12px;
    color: var(--dh-text-secondary);
    margin-top: 4px;
    display: block;
}

body.dh-page .dh-btn-icon {
    background: var(--dh-primary-soft);
    color: var(--dh-primary-color);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

body.dh-page .dh-btn-icon:hover {
    background: var(--dh-primary-color);
    color: #fff;
    transform: rotate(15deg);
}

body.dh-page .dh-btn-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

body.dh-page .dh-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

body.dh-page .dh-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}

body.dh-page .dh-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.03);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

body.dh-page .dh-item:hover {
    transform: translateY(-4px);
    background: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    z-index: 2;
}

body.dh-page .dh-img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s;
    user-select: none;
}

body.dh-page .dh-img.loaded {
    opacity: 1;
}

body.dh-page .dh-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(8px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

body.dh-page .dh-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

body.dh-page .dh-sheet {
    background: rgba(255,255,255,0.95);
    width: 100%;
    max-width: 400px;
    border-radius: 20px 20px 0 0;
    padding: 25px;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}

body.dh-page .dh-overlay.active .dh-sheet {
    transform: translateY(0);
}

body.dh-page .dh-preview {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dh-page .dh-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

body.dh-page .dh-sheet-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-bottom: 8px;
    background: #f2f2f7;
    color: var(--dh-primary-color);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

body.dh-page .dh-sheet-btn:hover {
    background: #e5e5ea;
}

body.dh-page .dh-sheet-btn.dh-primary {
    background: var(--dh-primary-color);
    color: white;
}

body.dh-page .dh-sheet-btn.dh-primary:hover {
    background: #0062cc;
}

body.dh-page .dh-sheet-btn.dh-cancel {
    background: transparent;
    color: #FF3B30;
    margin-top: 5px;
}

@media (max-width: 480px) {
    body.dh-page .dh-gallery {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    body.dh-page .dh-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

body.page-toolbox {
    min-height: 100vh;
    height: auto;
    width: 100%;
    align-items: stretch;
    justify-content: flex-start;
    overflow: auto;
}

.toolbox-shell {
    width: 100%;
    min-height: 100vh;
}

.toolbox-lock[hidden],
.toolbox-workbench[hidden],
.toolbox-auth-panel[hidden] {
    display: none !important;
}

.toolbox-lock {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    box-sizing: border-box;
}

.toolbox-lock-card {
    width: min(420px, 100%);
    padding: 36px 30px;
    box-sizing: border-box;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 22px 60px rgba(40, 73, 110, 0.16);
    backdrop-filter: blur(14px);
    text-align: center;
}

.toolbox-mark {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #007AFF, #34C759);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    box-shadow: 0 12px 24px rgba(0, 122, 255, 0.22);
}

.toolbox-lock-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
    color: #1f2937;
}

.toolbox-lock-card p {
    margin: 0 0 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.toolbox-password-row {
    display: grid;
    grid-template-columns: 1fr 96px;
    gap: 10px;
}

.toolbox-auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
    padding: 4px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.045);
}

.toolbox-auth-tabs button {
    min-height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    background: transparent;
    color: #667085;
    font-size: 14px;
    box-shadow: none;
}

.toolbox-auth-tabs button:hover,
.toolbox-auth-tabs button.active {
    background: #fff;
    color: var(--primary-color);
}

.toolbox-key-picker {
    min-height: 48px;
    padding: 0 14px;
    border: 2px dashed rgba(0, 122, 255, 0.25);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.64);
    color: #667085;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    cursor: pointer;
    font-size: 14px;
    transition: border-color .2s, background .2s, color .2s;
}

.toolbox-key-picker:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
}

.toolbox-key-picker input {
    display: none;
}

.toolbox-key-button {
    margin-top: 10px;
}

.toolbox-password-row input {
    text-align: left;
    letter-spacing: 0;
    background: rgba(255, 255, 255, 0.78);
}

.toolbox-password-row button {
    width: 100%;
}

.toolbox-lock-msg {
    min-height: 20px;
    margin-top: 12px;
    color: var(--error-color);
    font-size: 13px;
}

.toolbox-back {
    display: inline-block;
    margin-top: 12px;
    color: #7b8794;
    text-decoration: none;
    font-size: 13px;
}

.toolbox-back:hover {
    color: var(--primary-color);
}

.toolbox-workbench {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 220px 1fr;
}

.toolbox-sidebar {
    min-width: 0;
    min-height: 100vh;
    padding: 22px 18px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.64);
    border-right: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 10px 0 30px rgba(40, 73, 110, 0.08);
    backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
}

.toolbox-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    color: #1f2937;
    font-size: 18px;
    font-weight: 700;
}

.toolbox-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #007AFF;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}

.toolbox-categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toolbox-category {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.56);
    color: #344054;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    box-shadow: none;
}

.toolbox-category:hover {
    background: rgba(255, 255, 255, 0.86);
    color: var(--primary-color);
}

.toolbox-category.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 10px 22px rgba(0, 122, 255, 0.24);
}

.toolbox-category b {
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.07);
    font-size: 12px;
}

.toolbox-category.active b {
    background: rgba(255, 255, 255, 0.2);
}

.toolbox-version {
    margin-top: auto;
    padding-top: 20px;
    color: #8b97a7;
    font-size: 12px;
}

.toolbox-main {
    min-width: 0;
    padding: 28px;
    box-sizing: border-box;
}

.toolbox-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    padding: 22px 24px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 16px 36px rgba(40, 73, 110, 0.10);
    backdrop-filter: blur(12px);
}

.toolbox-header h1 {
    margin: 0 0 8px;
    color: #1f2937;
    font-size: 28px;
}

.toolbox-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.toolbox-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbox-actions input {
    width: 260px;
    text-align: left;
    letter-spacing: 0;
    background: rgba(255, 255, 255, 0.86);
}

.toolbox-home-link {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 122, 255, 0.10);
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.toolbox-home-link:hover {
    background: var(--primary-color);
    color: #fff;
}

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

.toolbox-app-card {
    min-height: 236px;
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 12px 28px rgba(40, 73, 110, 0.10);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.toolbox-app-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 40px rgba(40, 73, 110, 0.14);
}

.toolbox-app-top {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.toolbox-app-icon {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #007AFF, #56C7D8);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.toolbox-app-top h2 {
    margin: 2px 0 6px;
    color: #1f2937;
    font-size: 18px;
    line-height: 1.25;
}

.toolbox-app-top p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.toolbox-app-meta {
    margin: 16px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.toolbox-app-meta span {
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.055);
    color: #667085;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toolbox-card-actions {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.toolbox-download,
.toolbox-official {
    min-height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.toolbox-download {
    background: rgba(0, 122, 255, 0.12);
    color: var(--primary-color);
}

.toolbox-download.primary {
    background: var(--primary-color);
    color: #fff;
}

.toolbox-download:hover {
    background: #0062cc;
    color: #fff;
}

.toolbox-download small {
    font-size: 11px;
    font-weight: 500;
    opacity: .85;
    white-space: nowrap;
}

.toolbox-official {
    background: rgba(52, 199, 89, 0.12);
    color: #188038;
    justify-content: center;
}

.toolbox-official:hover {
    background: #34C759;
    color: #fff;
}

.toolbox-empty,
.toolbox-load-error {
    padding: 34px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.66);
    color: var(--text-secondary);
    text-align: center;
}

@media (max-width: 860px) {
    .toolbox-workbench {
        grid-template-columns: 1fr;
    }

    .toolbox-sidebar {
        min-height: auto;
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 14px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.65);
    }

    .toolbox-brand {
        margin-bottom: 12px;
    }

    .toolbox-categories {
        flex-direction: row;
        overflow-x: auto;
        max-width: 100%;
        padding-bottom: 4px;
    }

    .toolbox-category {
        width: auto;
        flex: 0 0 auto;
        gap: 10px;
    }

    .toolbox-version {
        display: none;
    }

    .toolbox-main {
        padding: 16px;
    }

    .toolbox-header {
        flex-direction: column;
        padding: 18px;
    }

    .toolbox-actions {
        width: 100%;
    }

    .toolbox-actions input {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .toolbox-lock {
        padding: 16px;
    }

    .toolbox-lock-card {
        padding: 28px 18px;
    }

    .toolbox-password-row {
        grid-template-columns: 1fr;
    }

    .toolbox-header h1 {
        font-size: 24px;
    }

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