:root {
            --bg-color: #000000;
            --surface-color: #0d0d0d;
            --surface-hover: #121212;
            --surface-card: #181818;
            --border-color: #222222;
            --border-highlight: #333333;
            
            --text-primary: #ffffff;
            --text-secondary: #a1a1aa;
            --text-muted: #888888;
            
            --pill-track: #111111;
            --pill-active: #222222;
            
            --status-waiting: #fbbf24;
            --status-connected: #22c55e;
            --status-transfer: #3b82f6;
            --status-error: #ef4444;
            --accent-cyan: #38bdf8;
        }

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

        body {
            background-color: var(--bg-color);
            color: var(--text-primary);
            font-family: 'Montserrat', sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
            padding: 0;
            margin: 0;
        }

        /* Navigation Bar */
        .top-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            padding: 16px 28px;
            background-color: var(--bg-color);
            border-bottom: 1px solid var(--border-color);
            position: sticky;
            top: 0;
            z-index: 40;
            backdrop-filter: blur(8px);
        }

        .nav-brand {
            display: flex;
            align-items: center;
            gap: 10px;
            text-decoration: none;
            color: var(--text-primary);
            cursor: pointer;
            transition: opacity 0.2s;
        }
        .nav-brand:hover { opacity: 0.85; }

        .nav-brand h1 {
            font-weight: 700;
            font-size: 1.25rem;
            letter-spacing: 0.5px;
            margin: 0;
        }

        .nav-right {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .btn-history {
            background: transparent;
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            font-family: 'Montserrat', sans-serif;
            font-size: 0.85rem;
            padding: 6px 14px;
            border-radius: 999px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.2s;
        }
        .btn-history:hover { color: var(--text-primary); border-color: var(--border-highlight); background-color: var(--surface-hover); }

        @media (max-width: 640px) {
            .top-nav { padding: 12px 16px; }
            .btn-history, .btn-install { padding: 6px 12px; font-size: 0.8rem; }
        }

        /* Content Wrapper & Layout (Centered like Transfer.it) */
        .content-wrapper {
            flex: 1;
            width: 100%;
            max-width: 1060px;
            padding: 32px 24px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            margin: 0 auto;
        }

        main {
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .workspace-grid {
            display: flex;
            flex-direction: row;
            gap: 24px;
            width: 100%;
            max-width: 980px;
            align-items: stretch;
            justify-content: center;
        }

        .card {
            background-color: var(--surface-color);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 24px;
            box-shadow: 0 16px 40px rgba(0,0,0,0.6);
            display: flex;
            flex-direction: column;
        }

        /* Left Card: Connection & Controls */
        .card-control {
            flex: 0 0 380px;
            width: 380px;
            max-width: 400px;
            align-self: center;
        }

        /* Right Card: Staging / Files Hub */
        .card-files {
            flex: 1;
            min-width: 380px;
            min-height: 440px;
            height: 100%;
            position: relative;
            align-self: stretch;
        }

        /* Pill Tab Switcher */
        .pill-track {
            display: flex;
            background-color: var(--pill-track);
            border: 1px solid var(--border-color);
            border-radius: 999px;
            padding: 3px;
            margin-bottom: 16px;
            width: 100%;
        }

        .pill-tab {
            flex: 1; text-align: center; padding: 8px 0; border-radius: 999px;
            cursor: pointer; font-weight: 600; font-size: 0.85rem;
            color: var(--text-muted); transition: all 0.2s ease;
        }
        .pill-tab.active {
            background-color: var(--pill-active); color: var(--text-primary);
            border: 1px solid var(--border-highlight); box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        }

        .panel { display: none; flex-direction: column; width: 100%; animation: fade-in 0.25s ease; }
        .panel.active { display: flex; }
        @keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

        .section-label {
            font-size: 0.72rem; color: var(--text-secondary); text-transform: uppercase;
            letter-spacing: 1.5px; font-weight: 600; margin-bottom: 10px; text-align: center;
        }

        /* Hardware Status Pill */
        .status-pill {
            display: inline-flex; align-items: center; justify-content: center; gap: 8px;
            background-color: var(--pill-track); border: 1px solid var(--border-color);
            padding: 6px 14px; border-radius: 999px; margin: 0 auto 16px auto; width: fit-content;
        }

        .status-text { font-size: 0.8rem; font-weight: 500; color: var(--text-primary); }
        .status-dot { width: 7px; height: 7px; border-radius: 50%; background-color: var(--text-muted); }
        
        .status-dot.waiting { background-color: var(--status-waiting); animation: pulse-waiting 2s infinite; }
        .status-dot.connected { background-color: var(--status-connected); box-shadow: 0 0 8px var(--status-connected); }
        .status-dot.transferring { background-color: var(--status-transfer); animation: pulse-transfer 2s infinite; }
        .status-dot.error { background-color: var(--status-error); box-shadow: 0 0 8px var(--status-error); }

        @keyframes pulse-waiting {
            0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); }
            70% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0); }
            100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
        }
        @keyframes pulse-transfer {
            0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
            70% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
            100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
        }

        /* OTP Code Display */
        .otp-container { display: flex; flex-direction: column; align-items: center; margin-bottom: 12px; }
        .otp-display, .otp-input {
            font-family: 'Roboto Mono', monospace; font-size: 2.2rem; font-weight: 600;
            letter-spacing: 0.25em; color: var(--text-primary); background-color: var(--bg-color);
            border: 1px solid var(--border-color); border-radius: 10px;
            padding: 8px 0 8px 0.25em; text-align: center; width: 100%; margin-bottom: 12px;
        }
        .otp-input { margin-bottom: 16px; transition: border-color 0.2s; font-size: 1.8rem; }
        .otp-input:focus { outline: none; border-color: var(--border-highlight); }
        .otp-input::placeholder { color: #222222; }

        /* Buttons */
        .btn-group { display: flex; gap: 8px; width: 100%; }
        .btn {
            font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 0.88rem;
            border-radius: 8px; padding: 11px 18px; cursor: pointer; transition: all 0.2s;
            width: 100%; border: none; display: flex; align-items: center; justify-content: center; gap: 8px;
        }
        .btn-sm { padding: 8px 14px; font-size: 0.8rem; }
        .btn-secondary { background-color: var(--pill-track); color: var(--text-primary); border: 1px solid var(--border-color); }
        .btn-secondary:hover:not(:disabled) { background-color: var(--pill-active); border-color: var(--border-highlight); }
        .btn-primary { background-color: var(--text-primary); color: var(--bg-color); }
        .btn-primary:hover:not(:disabled) { background-color: #e5e5e5; }
        .btn-cancel { background-color: var(--bg-color); color: var(--text-primary); border: 1px solid #7f1d1d; }
        .btn-cancel:hover:not(:disabled) { background-color: #7f1d1d20; border-color: #ef4444; }
        .btn:disabled { opacity: 0.4; cursor: not-allowed; }

        /* Transfer Password / Shared Secret Box */
        .security-box {
            background-color: var(--bg-color);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 8px 10px;
            margin-top: 10px;
            width: 100%;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .security-toggle-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 0.78rem;
            color: var(--text-secondary);
            cursor: pointer;
            user-select: none;
        }
        .security-toggle-left {
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .security-toggle-row input[type="checkbox"] {
            accent-color: #ffffff;
            cursor: pointer;
            width: 14px;
            height: 14px;
        }
        .security-input-wrap {
            display: none;
            position: relative;
            width: 100%;
            margin-top: 2px;
        }
        .security-input {
            width: 100%;
            background-color: var(--pill-track);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 6px 30px 6px 10px;
            font-family: 'Roboto Mono', monospace;
            font-size: 0.85rem;
            color: var(--text-primary);
            letter-spacing: 0.05em;
            outline: none;
            transition: border-color 0.2s;
        }
        .security-input:focus {
            border-color: var(--border-highlight);
        }
        .security-eye-btn {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 2px;
            display: flex;
            align-items: center;
        }
        .security-eye-btn:hover {
            color: var(--text-primary);
        }

        /* Wake Lock Status Badge in Top Nav */
        .wake-lock-badge {
            display: none;
            align-items: center;
            gap: 5px;
            background-color: rgba(34, 197, 94, 0.12);
            border: 1px solid rgba(34, 197, 94, 0.35);
            color: #4ade80;
            font-size: 0.72rem;
            font-weight: 500;
            padding: 5px 10px;
            border-radius: 999px;
            animation: fade-in 0.2s ease;
        }
        .wake-lock-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background-color: #22c55e;
            box-shadow: 0 0 6px #22c55e;
        }

        /* Connection & Readiness Box */
        .connection-status-box {
            background-color: var(--pill-track);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 10px 12px;
            margin-top: 12px;
            font-size: 0.78rem;
            line-height: 1.4;
            color: var(--text-secondary);
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .status-box-header {
            display: flex;
            align-items: center;
            gap: 6px;
            color: var(--text-primary);
            font-weight: 600;
            font-size: 0.8rem;
        }
        .status-box-icon {
            width: 14px;
            height: 14px;
            color: var(--text-muted);
        }
        .status-box-desc {
            margin: 0;
            color: var(--text-muted);
        }

        .send-action-wrap { margin-top: 12px; width: 100%; }

        /* RIGHT CARD - Dual Add Boxes (Transfer.it style) */
        .files-view { display: flex; flex-direction: column; width: 100%; height: 100%; }

        .add-zones-grid {
            display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px;
        }

        .add-box {
            border: 1px dashed var(--border-color); border-radius: 12px;
            padding: 16px 12px; text-align: center; background-color: var(--bg-color);
            transition: all 0.2s ease; cursor: pointer; display: flex; flex-direction: column;
            align-items: center; justify-content: center; gap: 6px;
        }
        .add-box:hover {
            border-color: var(--border-highlight); background-color: var(--pill-track);
            transform: translateY(-1px);
        }
        .add-box.active-drag {
            border-color: #3b82f6; background-color: rgba(59, 130, 246, 0.08);
        }
        .add-box-icon {
            width: 26px; height: 26px; color: var(--text-secondary); stroke: currentColor;
            stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none;
            transition: color 0.2s;
        }
        .add-box:hover .add-box-icon { color: var(--text-primary); }
        .add-box-title { font-weight: 600; font-size: 0.88rem; color: var(--text-primary); }
        .add-box-sub { font-size: 0.72rem; color: var(--text-muted); }

        /* Staged Header / Status Bar */
        .staged-header-row {
            display: flex; justify-content: space-between; align-items: center;
            padding: 4px 2px 8px 2px; border-bottom: 1px solid var(--border-color); margin-bottom: 10px;
        }
        .staged-counter {
            font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
            display: flex; align-items: center; gap: 6px;
        }
        .staged-counter span { color: var(--text-primary); font-weight: 600; }
        .dot-separator { color: var(--text-muted); font-size: 0.8rem; }
        .btn-icon-clear {
            background: none; border: none; color: var(--text-muted); cursor: pointer;
            padding: 4px; border-radius: 6px; display: flex; align-items: center; transition: all 0.2s;
        }
        .btn-icon-clear:hover { color: var(--status-error); background-color: rgba(239, 68, 68, 0.1); }

        /* Files List */
        .file-list {
            display: flex; flex-direction: column; width: 100%;
            flex: 1; max-height: 240px; overflow-y: auto; gap: 6px;
            padding-right: 4px;
        }
        .file-list::-webkit-scrollbar { width: 5px; }
        .file-list::-webkit-scrollbar-thumb { background-color: var(--border-highlight); border-radius: 4px; }
        
        .file-list-item {
            display: flex; justify-content: space-between; align-items: center;
            background-color: var(--pill-track); border: 1px solid var(--border-color);
            padding: 8px 12px; border-radius: 8px; transition: border-color 0.2s;
        }
        .file-list-item:hover { border-color: var(--border-highlight); }
        .file-item-left {
            display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1;
        }
        .file-item-icon {
            width: 16px; height: 16px; color: var(--text-secondary); flex-shrink: 0;
        }
        .file-name {
            font-weight: 500; font-size: 0.85rem; color: var(--text-primary);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .file-item-right {
            display: flex; align-items: center; gap: 10px; flex-shrink: 0;
        }
        .file-size { font-family: 'Roboto Mono', monospace; font-size: 0.75rem; color: var(--text-secondary); }
        .btn-remove-item {
            background: none; border: none; color: var(--text-muted); cursor: pointer;
            padding: 2px; border-radius: 4px; display: flex; align-items: center; transition: color 0.2s;
        }
        .btn-remove-item:hover { color: var(--status-error); }

        /* Empty State */
        .files-empty-state {
            flex: 1; display: flex; flex-direction: column; align-items: center;
            justify-content: center; text-align: center; padding: 24px 16px;
            border: 1px dashed var(--border-color); border-radius: 12px;
            color: var(--text-muted); font-size: 0.82rem; line-height: 1.5;
            background-color: rgba(13, 13, 13, 0.4); min-height: 160px;
        }
        .files-empty-state.active-drag {
            border-color: #3b82f6; background-color: rgba(59, 130, 246, 0.08); color: var(--text-primary);
        }

        .receive-idle-state {
            flex: 1; display: flex; flex-direction: column; align-items: center;
            justify-content: center; text-align: center; padding: 32px 20px;
            color: var(--text-muted); min-height: 200px;
        }

        .badge {
            background-color: var(--bg-color); border: 1px solid var(--border-color);
            padding: 4px 8px; border-radius: 4px; font-family: 'Roboto Mono', monospace;
            font-size: 0.75rem; color: var(--text-secondary);
        }
        .badge-success { color: var(--status-connected); border-color: var(--status-connected); background-color: rgba(34, 197, 94, 0.1); }

        .route-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.75rem;
            font-weight: 500;
            padding: 4px 10px;
            border-radius: 9999px;
            letter-spacing: 0.01em;
            transition: all 0.2s ease;
        }
        .route-badge-lan {
            background: rgba(34, 197, 94, 0.15);
            color: #4ade80;
            border: 1px solid rgba(34, 197, 94, 0.35);
        }
        .route-badge-wan {
            background: rgba(56, 189, 248, 0.15);
            color: #38bdf8;
            border: 1px solid rgba(56, 189, 248, 0.35);
        }

        /* Transfer Metrics */
        .transfer-stats {
            display: none; flex-direction: column; width: 100%; margin-top: 12px;
            padding: 14px; background-color: var(--bg-color); border: 1px solid var(--border-color); border-radius: 10px;
        }

        .progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
        .progress-title { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%; }
        .progress-pct { font-family: 'Roboto Mono', monospace; font-size: 1rem; font-weight: 600; color: var(--text-primary); }

        .batch-progress-text { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; }

        .progress-track {
            width: 100%; height: 5px; background-color: var(--pill-track);
            border-radius: 999px; overflow: hidden; margin-bottom: 8px;
        }
        .progress-fill { height: 100%; width: 0%; background-color: var(--text-primary); transition: width 0.1s linear; }

        .progress-footer { display: flex; justify-content: space-between; font-family: 'Roboto Mono', monospace; font-size: 0.72rem; color: var(--text-muted); }

        /* Responsive Breakpoint for Mobile / Small Screens */
        @media (max-width: 860px) {
            .workspace-grid {
                flex-direction: column;
                align-items: center;
                gap: 16px;
            }
            .card-control, .card-files {
                width: 100%;
                max-width: 520px;
                flex: none;
                min-height: auto;
            }
            .file-list {
                max-height: 200px;
            }
            .content-wrapper {
                padding: 16px 14px;
                justify-content: flex-start;
            }
        }

        /* SVG Icons */
        .icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }

        /* Site Footer */
        .site-footer {
            width: 100%;
            border-top: 1px solid var(--border-color);
            padding: 28px 24px;
            text-align: center;
            background-color: var(--bg-color);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
            margin-top: auto;
        }

        .footer-tagline {
            font-size: 0.85rem;
            color: var(--text-secondary);
            max-width: 600px;
            margin: 0;
        }

        .footer-links {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 16px;
            flex-wrap: wrap;
        }

        .footer-link {
            color: var(--text-muted);
            text-decoration: none;
            font-size: 0.82rem;
            transition: color 0.2s;
        }

        .footer-link:hover {
            color: var(--text-primary);
        }

        .footer-divider {
            color: var(--border-highlight);
            font-size: 0.8rem;
        }

        .footer-copy {
            font-size: 0.75rem;
            color: var(--text-muted);
            margin: 0;
        }

        /* History Modal */
        .modal-overlay {
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            background-color: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
            display: none; justify-content: center; align-items: center; z-index: 100; padding: 20px;
        }
        .modal-content {
            background-color: var(--surface-color); border: 1px solid var(--border-color);
            border-radius: 16px; width: 100%; max-width: 600px; max-height: 80vh;
            display: flex; flex-direction: column; box-shadow: 0 16px 40px rgba(0,0,0,0.8);
        }
        .modal-header { padding: 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
        .modal-header h2 { font-size: 1.2rem; font-weight: 600; }
        .close-modal { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; }
        .close-modal:hover { color: var(--text-primary); }
        .modal-body { padding: 0; overflow-y: auto; overflow-x: auto; }
        
        .history-table { width: 100%; min-width: 400px; table-layout: fixed; border-collapse: collapse; text-align: left; }
        .history-table th { font-size: 0.75rem; text-transform: uppercase; color: var(--text-secondary); padding: 16px 12px; border-bottom: 1px solid var(--border-color); background-color: var(--pill-track); }
        .history-table td { padding: 16px 12px; border-bottom: 1px solid var(--border-color); font-size: 0.85rem; color: var(--text-primary); }
        .history-table th:nth-child(1), .history-table td:nth-child(1) { width: 40%; }
        .history-table th:nth-child(2), .history-table td:nth-child(2) { width: 25%; }
        .history-table th:nth-child(3), .history-table td:nth-child(3) { width: 15%; }
        .history-table th:nth-child(4), .history-table td:nth-child(4) { width: 20%; }
        .history-table tr:last-child td { border-bottom: none; }
        .empty-history { text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.9rem; }
